I have a JSON file (myfile.json
) that looks like this:
{"3":["c","d"], "3.5":["j","k"], "1.5":["a","b"], "2.5":["x","y"] }
What I want to do open the file and sort it using d3.js file opening.
d3.json('myfile.json',function(err,datafull){
for (var myval in datafull) {
console.log(myval);
}
});
Now if I do that, the console.log will print they key in unsorted manner. How can I sort the file?
This is different question, because it involves file parsing.