Non riesco a capire come accedere ai dati contentuti in una stringa JSON che mi viene retituita dal server....
La stringa è la seguente:
Io dovrei accedere ai valori di value, ad esempio a "http://www.w3.org/1999/02/22-rdf-syntax-ns#type".codice:{ "head": { "link": [], "vars": ["p"] }, "results": { "distinct": false, "ordered": true, "bindings": [ { "p": { "type": "uri", "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" }}, { "p": { "type": "uri", "value": "http://www.w3.org/2000/01/rdf-schema#label" }}, { "p": { "type": "uri", "value": "http://xmlns.com/foaf/0.1/name" }}, { "p": { "type": "uri", "value": "http://xmlns.com/foaf/0.1/img" }}, { "p": { "type": "uri", "value": "http://xmlns.com/foaf/0.1/based_near" }} ] } }
Ho provato con un
ma mi da un errore (Cannot read property 'value' of undefined), quindi sicurmente non si fa in questo modo.codice:var str="Success!\n"; for(var x in json.results.bindings){ str+=x.p.value+"\n"; } alert(str);
Avete qualche idea per leggere la il valore di "value"?
Grazie in anticipo!

Rispondi quotando