4 ms·
I created a minimal schema for JSON a few years ago: http://jschema.org/ http://jschema.org/ The idea was/is to capture the spirit of JSON minimalism, avoidin
by carsongross 10y ago
I created a minimal schema for JSON a few years ago:
http://jschema.org/ http://jschema.org/
The idea was/is to capture the spirit of JSON minimalism, avoiding the insanity of XML-based schema languages.
Currently, some UCSC students are working on javascript and java tools to work with schemas. We should be able to release that work in the next month or so.
- drdaeman 10y agoThere's also JSONSchema (http://json-schema.org/ http://json-schema.org/), which is significantly more verbose, but has optionals, string length constraints and other sort of quite useful stuff. And there is (or, better say, was) an "Orderly JSON" language that had nice and compact human-manageable representations, but had essentially died from nobody using it. JSchema: { "name": "@string", "age": "@int" } Pros: is JSON, is simple to read and write. Cons: is (currently) limited to very primitive schemas. JSONSchema: { "type": "object", "properties": { "name": {"type": "string"}, "age": {"type": "integer", "minimum": 0, "description": "Age in years"} }, "required": ["name"] } Pros: is JSON and reasonably powerful. Seems to be a most common standard out there, with lots of libraries available. Cons: is verbose to the extent it's no fun to read or write by hand. Has some ambiguities and - as the OP article correctly says - spec is unfinished. Orderly JSON: object { string name; integer {0,} age?; }; Pros: compact and powerful. Cons: not JSON but a custom grammar, no one uses it.
- cmpb 10y agoThe article linked to by the post describes JSON Schema's shortcomings as well.
- drdaeman 10y agoYes, you're right. Thanks. I've edited my post above, adding this to JSONSchema cons.
- xirdstl 10y agoWe use JSONSchema in several places. It has met our needs pretty well, particularly for dynamic form generation (using the angular-schema-form library)
- throwanem 10y agoAs long as you don't need good interop, JSON Schema can be pretty great. (If you need interop, it's not, because none of the tools seem to implement unspecified behavior the same way.)
- drdaeman 10y agoEven when you need interoperation, the well-defined subset of JSONSchema may do reasonably well. I think every library out there handles the essentials (the core types and basic constraints) in the exactly same manner, and the incompatibilities starts with less common things like references etc.
- flamedoge 10y agoOrderly JSON looks very similar to protocolbuffer
- drdaeman 10y agoIt is. I don't know the authors, and now the site and blog had died, but I won't be surprised if they had took some inspiration from there.