News for hackers. Stuff that matters.
Re:The Pretty JSON Revolution by ajuc on Tuesday February 23, 2021 @10:37AM (#26238479)
That's the point GP is making. Use JSON objects for dictionary-like structures instead of directly translating XML to JSON.
Re:The Pretty JSON Revolution by SamBam on Tuesday February 23, 2021 @11:05AM (#26238873)
But the point is that it's always usage dependant.

You key by color names, that seems obvious. But what if you want to look up a color by hex? Now you have to look through them all.

What if this list is actually an order list of colors for different headings? And they can repeat? Then indexing by index is exactly what you want.

Point is, you don't know the reason behind the data structure.

(That said, I do wish the json had a standardized way to remove redundancy for objects that always follow the same structure. One list of property names, and then everything in arrays.)

Re:The Pretty JSON Revolution by falcolas on Tuesday February 23, 2021 @11:15AM (#26239024)
> But what if you want to look up a color by hex? Now you have to look through them all.

As you would with the original one as well.

> Then indexing by index is exactly what you want.

A much better use case. That said, the list order is kinda fragile, having an explicit row identifier might be worth adding. Especially since all of the columns are being explicitly called out instead of in their own list.