JavaScript objects are similar to JSON and allow all this and it works just fine. They never misinterpret anything.
So why can't JSON be more forgiving? I remember XML used to be the same back in the day.
Why do creators of schema make them so strict? Isn't the whole thing about making life of users (or devs in the case) easier? What purpose does such fussy specifications achieve?
> Why do creators of schema make them so strict? Isn't the whole thing about making life of users (or devs in the case) easier? What purpose does such fussy specifications achieve?
No, the purpose is correctness. It prevents you from writing malformed structures, allows machines to automatically check for correctness, and downstream programs to make assumptions about its correctness without errors.
JSON is machine readable first, human readable second, machine writeable third, and human writeable last. It makes sense not to prioritize writing it by hand.
Most of the time if you are writing JSON by hand, you've screwed something up.
Re comments, Crockford said: "I removed comments from JSON because I saw people were using them to hold parsing directives, a practice which would have destroyed interoperability." See: https://archive.ph/20150704102718/https://plus.google.com/+D...
>>> {"test":4}
{'test': 4}