4 ms·
> And we didn't even need to get into the needless complexity of validation, namespaces, and other junk. So, that’s why we’re adding all of this “junk” back in
by falcolas 7y ago
> And we didn't even need to get into the needless complexity of validation, namespaces, and other junk.
So, that’s why we’re adding all of this “junk” back into JSON? Transformers, XPath for JSON, validation, schemas, namespaces (JSON-LD, JSON prefixes) it’s all there.
History repeating itself (and here’s the important part) because this complexity is needed. Not every application will need every complication, but every complication is needed by some application.
- robocat 7y agoNo junk has been added into JSON - the specification hasn't changed to accommodate those features. Unless you need to use the feature, you don't need to know anything about it, which is a huge benefit for the majority. XML almost encourages programmers to use unnecessary features. When an application domain chooses to add a feature (say JSON-LD) then there are advantages to that mixture over XML. Where XML is better, it is often chosen instead.
- falcolas 7y ago> the specification hasn't changed to accommodate those features. Neither did XML. They simply took advantage of an early "processing directive" feature to add them in. XML and JSON are no different in this regard.
- ChrisSD 7y agoExcept that JSON doesn't have anything like processing directives or even comments.
- falcolas 7y agoThat depends entirely on which parser you’re using. People have wanted comments so badly there are parsing libraries (and proposed revisions to JSON) that include comments. And sometimes those comments are used to provide processing directives. https://json5.org/ https://json5.org/ Jsonnet https://www.npmjs.com/package/comment-json https://www.npmjs.com/package/comment-json > Suppose you are using JSON to keep configuration files, which you would like to annotate. Go ahead and insert all the comments you like. Then pipe it through JSMin before handing it to your JSON parser.
- reissbaker 7y agoNeither Jsonnet nor JSON5 are JSON, and they're considerably less popular than their forebear. (Although I do love JSON5.)