3 ms·
JSON.stringify and JSON.parse? They're standard library functions that many languages have, I don't see what's ES6 about them, they're much older. First class
by Scarblac 8y ago
JSON.stringify and JSON.parse? They're standard library functions that many languages have, I don't see what's ES6 about them, they're much older.
First class treatment would be if the language had JSON-typed objects with functionality, e.g. something like
const myJson = j'{"key":"value"}';
const value = myJson['key'];
const newJson = myJson.set("otherkey", "newValue");
(using the j'' notation for a hypothetical json-typed value)
But AFAIK it doesn't, not even in ES6.
- brlewis 8y agohttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... Implementing j`{"key":"value"}`; as a tagged template literal is left as an exercise for the reader.