bhollis/jsonview

keys are being reordered for tree view

Closed this issue · 5 comments

Opening this:

{"data":{"STRING1":-10,"0":-0.1,"1":0,"STRING2":20}}

In the nice tree view, keys are re-ordered to:

0,1,STRING1,STRING2

Would be nicer if they stay in the order they are in the JSON.

Using Firefox Quantum 64.0.2 (64-bit)

Unfortunately order isn’t guaranteed - we just show whatever the browser’s JSON parser ends up doing.

Should I raise it as a firefox issue then ?

That sounds best.

It does the same thing in Chrome. Any idea why that might be ?

Seems they all do the same thing,

https://stackoverflow.com/questions/5020699/how-do-you-stop-chrome-and-opera-sorting-json-objects-by-index-asc

You can stop it by adding something non-numeric to the key _ or i perhaps, seems like a bit of a hack. Would it be interesting to know why they thought this was a good idea.