Live data from Hacker News

Better Than JSON?

wiki.alopex.li

51–60 of 153 posts

Re: Better Than JSON?

#51

Also worth looking are EDN [0] (mentioned briefly under S-Expressions), Transit [1] and Fressian [2][3]. [0] https://github.com/edn-format/edn [1] https://github.com/cognitect/transit-format [2] https://github.com/Datomic/fressian/wiki [3] https://www.youtube.com/watch?v=JArZqMqsaB0&ab_channel=Cloju...

Yeah, the author didn’t specify why he thought EDN wasn’t more than “a good start.” I’m curious what it’s missing!

If you follow the link, you'll see that there are no examples of data in the format and the README declares things like that it will provide a BNF when the specification ready. The context seems to imply that it is in an early implementation stage and not ready for non-enthusiast consumption. Also, last updated in 2014.

Re: Better Than JSON?

#53

On XML: > Not sure anyone really knows how XML happened. It’s > basically the W3C’s fault, I think? It’s okay for some > things but in the end I’m not sure it’s something anyone > actually wants to use, it’s just going to be one more of > those mistakes of the past. Look, I was doing web dev when XMLRPC was in. For simple API stuff, JSON ended up being worlds better. No fiddly XML preamble, no schemas, no envelopes,…

    XML can be a bear, but sometimes you need a bear.
Phrase heard at conferences in the 90's/2000's:

    "XML is like violence. If it doesn't work, you're not using enough of it."

Re: Better Than JSON?

#54

On XML: > Not sure anyone really knows how XML happened. It’s > basically the W3C’s fault, I think? It’s okay for some > things but in the end I’m not sure it’s something anyone > actually wants to use, it’s just going to be one more of > those mistakes of the past. Look, I was doing web dev when XMLRPC was in. For simple API stuff, JSON ended up being worlds better. No fiddly XML preamble, no schemas, no envelopes,…

Yes. Can't agree more.

This coming from someone who hates XML, avoids it at nearly all costs - there are times it's the right tool for the job. And you list that time. If you have a 1-1 API contract, don't use XML. If you have 1-N, don't use XML. But if you have N-N API contracts? Where you're talking to half a dozen other services, and they're all talking to you? XML is an excellent choice.

Re: Better Than JSON?

#55
In some sense JSON is unimprovable, because some properties of JSON are reached their limits.

The idea of JSON is to offer two important ways to aggregate, which are different enough that they deserve separate treatment - ordered array and associative array. They are economically represented, with [] and {}, and internal structure is also made with small costs - commas (,) between elements and colons (:) for keys in associative array. We can argue that both of those features are required.

Chosen primitives - numbers, strings, booleans and null - are also selected from what's regularly and consistently used, and the choice is supported by two decades of JSON application. Roots of this selection are in design of JavaScript, which in turn relied on common practice for basic primitives.

If JSON is considered as what I think it is, structure out of basic primitives, it's at the optimal point. Crockford's decision to avoid JSON versioning makes a good sense.

Applications of JSON - human-readable texts, performance-optimized communications - can suffer from e.g. lack of built-in comments, non-extensible "type system", non-optimal bandwidth usage (if direct ASCII or even UTF-8 is used for JSON encoding, not some other compressed approach). They however can be fixed by building on top of JSON. For example, parties can agree upon reserved keys and compression schemas, constraints in form of grammars (JSON-Schema). This flexibility stems from the fact that JSON is at the very foundation of data structures, so "better than JSON" is to an extent like "better than two's complement number representation".

Re: Better Than JSON?

#56

Also worth looking are EDN [0] (mentioned briefly under S-Expressions), Transit [1] and Fressian [2][3]. [0] https://github.com/edn-format/edn [1] https://github.com/cognitect/transit-format [2] https://github.com/Datomic/fressian/wiki [3] https://www.youtube.com/watch?v=JArZqMqsaB0&ab_channel=Cloju...

Yeah, the author didn’t specify why he thought EDN wasn’t more than “a good start.” I’m curious what it’s missing!

What's missing is major projects using it I think. Note how for every example he lists the big players keeping it alive.

Re: Better Than JSON?

#59
post #39

The only problem with json is that you can't do comments with the default implementation.

No trailing commas and multi-line strings are my other two big complaints. The ability to leave keys unquoted if they don't have any spaces would also be nice. The best part is that these are a superset of JSON and could easily be added if there would just be more buy-in (lots of unofficial support already exists).

The author does mention JSON5 which implements all of those features.

Re: Better Than JSON?

#60
if you are sending data to "yourself" and performance is important, defining your own binary protocol can be very effective. every time I go to grok protobuf, thrift, et al. I end up just rolling my own format because it's so much simpler and I can take all the tradeoffs that benefit what I'm doing instead of what anyone might possibly do with it. this doesn't apply in many situations (i.e. sending data to outside parties) but I've experienced a lot of success with it that seems at odds with conventional wisdom on the subject.
Post reply on HN