I want to read json response as name and value pairs in my JQuery code. Here is my sample JSON response that I return from my java code:
String jsonResponse
You can just use responseData['name1']
. Easy.
It's easy like this:
json = {"key1": "value1", "key2": "value2" };
$.each(json, function(key, value) { alert(key + "=" + value); });
success: function(responseData) {
for (var key in responseData) {
alert(responseData[key]);
}
}
It is important to note that the order in which the properties will be iterated is arbitrary and shouldn't be relied upon.