How to analyze Json data in javascript containing a URL as name

advertisements

I am unable to parse the json file obtained from this http://dbpedia.org/data/Los_Angeles.json url.

I need to find the populationTotal, areaTotal, populationDensity fields from the json data obatined from the URL above.

This is a snippet of the json data obtained from http://dbpedia.org/data/Los_Angeles.json url. Eg.

"http://dbpedia.org/ontology/populationTotal" : [
{ "type" : "literal",
  "value" : 3792621 ,
  "datatype" : "http://www.w3.org/2001/XMLSchema#integer" } ] ,
"http://dbpedia.org/ontology/PopulatedPlace/areaTotal" : [
{ "type" : "literal",
  "value" : "1301.9688931491348" ,
  "datatype" : "http://dbpedia.org/datatype/squareKilometre" } ,

How could i get this Json data and output it using Javascript.


Do this help you?

var populationTotalData=[];
for(var key in data) {
    if(key.match(/populationTotal/))
    // or simplier: if(key.indexOf("populationTotal")>-1)
        populationTotalData.push(data[key]);
}