I have data in the format
{
"id1":["name1",10,20],
"id2":["name2",12,20],
"id3":["name3",14,21]
}
and am reading it in with
var dat;
$(document).ready(function() {
$.getJSON('data.json', function(data) {
dat = data.items;
console.log(dat);
});
});
This is proving problematic to read into properly because I gather (please clarify if I'm wrong) this is a poor json format as it lacks field names. Moreover the ':' seems to create something like a dictionary class and I'm not sure if that is preventing the resulting object from being iterable. If I call it in the console (e.g. dat[0]
) I get "undefined", but perhaps there is an additional jquery error here.
So the question is how read this in so the data is accessible/iterable? Thanks in advance.