3 ms·
These days, JS has moved on while JSON has remained stuck in the past. There are some fairly important ones it'd be great to get a standard format for in JSON.
by kybernetikos 5y ago
These days, JS has moved on while JSON has remained stuck in the past. There are some fairly important ones it'd be great to get a standard format for in JSON. e.g.
JSON.stringify({z: 1n})
Also, round tripping ArrayBuffers, Maps, Sets, Symbols and Dates would be really useful. Sadly JSON5 doesn't address those.
I'd quite like a next gen JSON not to get upset on circular references too, although that would most likely require some sort of link or reference data type.
- pitaj 5y agoBigints, dates, and buffers I can understand to a degree. Sets can easily be serialized as a json array. Maps can be serialized as a json array of arrays or as a single json dictionary if the key types are compatible.
- kybernetikos 5y agoEverything can be serialised as something else with various degress of difficulty, but one of the beauties of JSON was that it had support for most of the native types of javascript. It's nice not to have to write special logic to serialise / deserialise the way you want. In particular, the ability to round trip all the standard types would be really useful.