As I provided in the comment section, the JSON data you provided is not a valid JSON entry. One curly brace is missing and there is duplicate entry of key in the JSON data.
I rectified it and did some more check to fulfill what you need. Here is the solution which is working so far :-
<script>
var jsonData = [{
"name": "Y",
"totalRecords": 30,
"Details": [{
"Info": "kumar1",
"Number": "123",
"otherDetails": {
"entry": [{
"class": "class2"
},
{
"key": "key2",
"value": "value2"
},
{
"key": "key1",
"value": "value1"
}
]
}
},
{
"Info": "kumar1",
"Number": "123",
"otherDetails": {
"entry": [{
"class": "class2"
},
{
"key": "key2",
"value": "value2"
},
{
"key": "key1",
"value": "value1"
}
]
}
}
]
}];
$.each(jsonData, function(key, value) {
console.log("key = " + key + " value= " + value);
if (typeof value === 'object') {
$.each(value, function (key1, value1) {
console.log("key1 = " + key1 + " value1= " + value1);
if (typeof value1 === 'object') {
$.each(value1, function (key2, value2) {
console.log("key2 = " + key2 + " value2= " + value2);
});
}
});
}
});
</script>
Note: Let me know if you still finding any issue getting the data.