How to use json object notation to retrieve dbpedia json data
Posted
by
Margi
on Stack Overflow
See other posts from Stack Overflow
or by Margi
Published on 2013-10-28T03:49:26Z
Indexed on
2013/10/28
3:53 UTC
Read the original article
Hit count: 432
JavaScript
|JSON
In my php code, I am retrieving json data as below.
<?php
$url = "http://dbpedia.org/data/Los_Angeles.json";
$data = file_get_contents($url);
echo $data;
?>
The javascript code consumes this json data returned from php and gets the json object as below.
var doc = eval('(' + request.responseText + ')');
How to retrieve the following json data using dot notations. The keys contain URLs.
"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" }
© Stack Overflow or respective owner