i have a json string in the format
var jsonData = [{"label":"Hass1([email protected])","value":"[email protected]"},{"label":"Hass([email protected])","value":"[email protected]"},{"label":"Sam([email protected])","value":"[email protected]"}]
i need to convert it in the format it into this way
var obj = {"Hass1([email protected])":"[email protected]",
"Hass([email protected])","[email protected]"}
how to do so?
I have implemented so far like
function ConvertMeJason(jsonMe) {
var list = JSON.parse(jsonMe);
list.Object.forEach(function (obj) { /// I am getting error undefined function foreach
emptyJson.add('"' + obj.label + '"', '"' + obj.value + '"');
})
}