Skip to content Skip to sidebar Skip to footer

Will Json Evolve To Have Native Support For Ecmascript Map Objects?

Are there any formal proposals, in progress, that address a backwards-compatible evolution to JSON's current treatment of Map objects? For example, let say you want to convert a Ma

Solution 1:

No, because JSON notation, while it originated with Javascript, is widely used in a very large number of languages, but a Javascript Map only has meaning within the context of Javascript.

Any sort of change to JSON notation to allow for the serialization and deserialization of objects that only have meaning in Javascript would make that JSON format incompatible with most other languages.

This isn't to say that a custom parser based on JSON couldn't be written to properly serialize and deserialize Maps, but such a thing would only be based on JSON, rather than being an addition to the JSON standard.

Solution 2:

Like CertainPerformance's answer, it's important that JSON remain as abstract as possible for the sake of portability and compatibility.

Wanted to add that keeping the integrity of the Map objects inside of a JSON object is really simple anyway without having to add a new specification; like adding a flag per Map during serialization.

Post a Comment for "Will Json Evolve To Have Native Support For Ecmascript Map Objects?"