All I am trying to do is reading an JSON file with data format as shown below and extract only id from nodes and store it in an array.
{"nodes":[
{"id":"1057457211927117824", "age":"20", "name":"a", "loaded":true},
{"id":"1057459284189970433", "age":"20", "name":"b", "loaded":true}
]
"links":[
{"id":"l01", "from":"1057457210467540992", "to":"1057455883972722689", "type":"friend"},
{"id":"l02", "from":"1057457271331057664", "to":"1057451606344646656", "type":"friend"}
]}
Below is the code I tried but its not working.
var node_id = [];
$.getJSON("data/newData.json", function (data) {
$.each(data, function (index, value) {
node_id.push(value[0]['id']);
});
});