I am trying to retreive the values present in the JSON Array.However,my code is failing to get it executed.Below posted is how the file looks like.
{
"meta" : {
"view" : {
"description" : "This data set shows the location of Baltimore City's Services.",
"columns" : [{
"cachedContents" : {
"top" : [{
"item" : "American Rescue Workers"
}
]
}
}
]
}
}
My Apologies if my JSON file has got some syntax issues.I am trying to access the item element present in cachedContents.Below posted is the code.
$(document).ready(function () {
$.get("https://data.baltimorecity.gov/api/views/hyq3-8sxr/rows.json", function (data) {
$.each(data.meta.view, function (i, obj) {
if (i == "name")
$("#result").append("<p align='center'>" + obj + "</p>");
if (i == "description")
$("#result").append("<p>" + obj + "</p>");
if (i == "columns")
$.each(obj.i.cachedContents, function (i1, obj) {
$("#result").append("<p>" + "hi" + "</p>");
});
});
});
});
Any suggestions would be highly helpful.