I have a JSON string and want to convert it to a an object in javascript, the only issue is the destination object will have different variable names and i want key to assign to a variable and value to a different variable
The JSON would be
{
"Value1":"Type1",
"Value2":"Type2"
}
The object will be
interface Object {
Value: string;
Type: string;
}
I want the JSON to be converted to object array where assigning key (Value1/Value2) to object variable Value and value (Type1/Type2) to object variable Type so the resultant object array would look like below
[{Value: Value1, Type: Type1}, {Value: Value2, Type: Type2}]
Regular JSON.parse wouldn't work as the object is different from json string, any help is appreciated.