13 lines
306 B
TypeScript
13 lines
306 B
TypeScript
interface KeyValue {
|
|
key: string;
|
|
value: any;
|
|
}
|
|
|
|
export function convertArrayToJsonString(array: KeyValue[]): string {
|
|
const jsonObject: { [key: string]: any } = {};
|
|
array.forEach(item => {
|
|
jsonObject[item.key] = item.value;
|
|
});
|
|
return JSON.stringify(jsonObject);
|
|
}
|
|
|