Here is a JSON string I am working with:
{"{\"nodeName\":\"abc\"}":[{"url":"abc","status":true},{"url":"abc","status":true}]," {\"nodeName\":\"pqr\"}":[{"url":"abc","status":true},{"url":"abc","status":true}]}
Although I can retrieve the value(v) using the code below, I'm struggling to get the key(k). Upon alerting, I receive (undefined abc true). The value of k remains undefined.
$.each(obj, function() {
$.each(this, function(k, v) {
alert(k.nodeName +" "+ v.url +" "+v.status);
});
});
I require the value of (k) for further validation. I have already validated the JSON string to ensure its validity, so what could I be missing here? Is there another approach I should consider? Your assistance would be greatly appreciated...
Furthermore, the JSON object being passed from the server end is structured as follows:
json.put(js.toString(),jsarray)
where
json = json OBject,
js = json Object,
jsarray = json Array.