I have a nested javascript object called data. Is there any way to iterate through it and find all properties that have the value undefined and set it to a string, “undefined” insted. JSON doesnt validate if the property value is undefined in IE7. Thanks
{
"Target": "System",
"Systemoperation": "Buy-In",
"Systemorigin": "ABB",
"Subscriptionmode": "Maintain & Evolve",
"Evolveto": "800xA",
"Quoteselection": "Full Quote",
"Commitmenttimeframe": "3 years",
"codevalues": {
"Target": 100,
"Systemoperation": 110,
"Systemorigin": false,
"Subscriptionmode": 4,
"Evolveto": undefined,
"Quoteselection": "fullquote",
"Commitmenttimeframe": 3
},
"Route": [
"System",
"Buy-In",
"ABB",
"Maintain & Evolve",
"800xA",
"Full Quote",
"3 years"
],
"currentsystem": ""
}
Here is evolteto in codevalues undefined. Which does not validate (try http://jsonlint.com/).
If this is your data structure (nested objs):
Then, this works for you