Live data from Hacker News

Better Than JSON?

wiki.alopex.li

41–50 of 153 posts

Re: Better Than JSON?

#41

I liked this CBOR vs MsgPack article from a while back (which also talks about size on the wire, not just performance): https://diziet.dreamwidth.org/6568.html SBE (Simple Binary Encoding) also makes some interesting performance claims. My pet peeve with both protobuf and capnp is the lack of an option type; they seem to be designed for languages with type systems that include null, rather than more modern languages…

Interestng read, didn't know most of this. Not that it matters in the end: at one point we just needed something simple which would just work and MessagePack does just that :)

Btw JSON is often a popular choice, but although this is not explicitly mentioned in the main article as a con which is an oversight imo, the actual JSON standard does not support NaN/+-Inf for floating point. That's insane, which is why most implementations have an option to allow that anyway, but not all, which can be quite the showstopper.

Re: Better Than JSON?

#43
post #27

After half a decade of "better than JSON" mentality, fiddling with thrift, protobufs, custom serialization methods, I came to realize JSON/HTTP is usually the right tool for 90% of jobs.

Agree. Handful of cases where thrift or grpc helps with an interface or streaming, but they seem to be the edge cases.

Re: Better Than JSON?

#44
One key element that I think is missing in this analysis is whether the format supports cyclic data out of the box. This is an important feature for many languages since it most languages besides Rust make it very difficult to determine if the data may contain cycles or not and handling cycles can be very expensive in terms of both time and memory for serialization.

Re: Better Than JSON?

#45

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,…

"Sometimes you eat the bear, and sometimes the bear eats you."

Re: Better Than JSON?

#46
post #2

S-expressions are the most logical representation of data structures. “CAR”/“CDR” are not a part of the expression syntax, so this argument against them won’t matter.

S-expressions are great once you've figured out functions, atoms, complex data types, etc. That's how Amazon's Ion[1] uses them: as a nice supplement to a serialization standard.

> “CAR”/“CDR” are not a part of the expression syntax

If you were implementing them for a serialization format, you'd leave out cons cells and car / cdr.

But in late-binding LISPs, which is where they're typically used, (a . b) is part of the syntax. It's worth calling out for why you don't want it: it's badly typed since it could be a 2-tuple, or it could be a list depending on what 'b' is.

[1]: https://amzn.github.io/ion-docs/docs/spec.html#sexp

Re: Better Than JSON?

#47

Wish the author would have checked out: https://borsh.io/ I've been using it lately but i'm i'll qualified to review it to any meaningful degree. It's neat, (reportedly) fast, but has seeming zero traction and thus makes me uneasy. (I'm currently (configurably) using it in place of bincode, for a content addressed store. for some context)

Looks pretty interesting, thanks for posting.

We'd also have a use case where we think about using bincode, this seems worth to check out/compare as a possible alternative.

Re: Better Than JSON?

#48

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,…

Much agreement here, and from the exact same usecase. Probably the easiest B2B API integration scenario I worked with in the past was XML + XML Schema validation. And I still think XML is more readable in many cases than JSON, because while verbose the hierarchical structure is very easy to grasp, sometimes I misread an entire JSON document at first because I missed a quick "[" or "[{" (yes I have also misread XML documents because of the sheer weight of text you are presented with, so I'll call that one a wash).

I do agree with the XML criticisms around writability and complexity, though I think if you made a Venn diagram of the actual complexities inherent in managing a multi-client document-exchange system and the complexities of XML+Schema, you'd find that they're similar--and that many people who start building such an exchange with JSON documents end up stumbling into the same amount of complexity except in an ad hoc fashion.

It's funny, I wonder if other people have the same surreal experience: as the mass zeitgeist moved away from XML I was more or less like, okay, gotta go with it, as the driftwood goes with the currents. It's interesting how the zeitgeist functions. You can tell it's happening when people look at your functional system and are like, "Uhh, why aren't you using X...?" as though it's self-evident that you should drop everything and rewrite. Where X was, over the years (dating myself) {"Java", "PHP", "Node", "Rails", "Jquery", "REST", "Angular", "React", "Thrift", "NoSQL", "Protobuf", "Hadoop"}. Some of which I quite happily used, BTW, so the interesting part is the penetrative nature of the conversation, e.g. how the quite-functional-but-not-hot technology becomes the sick gazelle falling behind the herd, even as it is not empirically sick.

Re: Better Than JSON?

#50
Author: "I’ve never gotten schemas and validation to actually work in practice”

Reality: Author somehow overlooked the fact that MS Office documents are all bundled xml files behaving exactly as intended

Lesson: One guy’s experience is not enough to decide which languages you use or how you build software

Post reply on HN