-
-
Notifications
You must be signed in to change notification settings - Fork 370
Description
One of the issues with JSON is that places basically no restrictions on parsers and generators. I first learned about this from a Reddit comment, of all things: https://www.reddit.com/r/programming/comments/59htn7/parsing_json_is_a_minefield/d98qxtj/
This puts projects like JSON Schema in an awkward position where they have to decide which details of JSON are insignificant and which aren't.
Clearly, whitespace outside of JSON Strings is insignificant. Clearly, the different between 1 and 2 is significant. But in between lies a gray area: Should JSON Schema be able to specify that certain control characters must be escaped? For instance the spec doesn't require x1f (DEL) to be escaped, but that might cause a problem in some circumstances. What about numbers? The difference between 10e2 and 10E2 is insignificant, but what about 100 and 1.00e2?
I'm working on a subset of JSON called Son that I'd like to be able to answer these problems. The goal is to eliminate redundencies in JSON so that actual restrictions can then be placed on parsers, such as "there should be a bijection from serialized Son to the parsed representation of Son". Then projects like JSON schema could only concern themselves with the subset of JSON represented by Son, instead of each project trying to figure out what part of JSON it wants to cover on its own.
If this doesn't seem like a helpful thing to base JSON Schema on feel free to just hit the close button, I don't want to clog up the issues with promoting my own project. If this does seem interesting, but you're not happy with the specific decisions Son made, please let me know either here or in Son's issues so I can look into it.