Live data from Hacker News

Transit: JSON Data Interchange Format

github.com

121–124 of 124 posts

Re: Transit: JSON Data Interchange Format

#121

Earlier quoted context omitted.

Without a strongly-typed data exchange format, you constantly have to write code that makes assumptions you hope the sender followed. Timestamps are ISO formatted. No, timestamps are seconds since 1970. No, they're floats including milliseconds. Blobs are base64. No, hex. Money is a string. No, it's a float. No, it's an int in micros. An empty array is different than an omitted field. No, they're the same. No, multip…

But no matter what format any bit of data is in, it should still be documented. Then any consumers of the data are going to have to convert it into a format that suits their language and application.

> But no matter what format any bit of data is in, it should still be documented.

That's what types are: enforced documentation.

Re: Transit: JSON Data Interchange Format

#122
post #116

Earlier quoted context omitted.

The point is, XML is quite good for unstructured, semi-structured and strongly-structured data and is more versatile from this point of view.

> The point is, XML is quite good for unstructured, semi-structured and strongly-structured data That's a highly-subjective and controversial point. (To me, XML is the Java of data languages -- its a lot worse than the best alternative considered on its own for almost any purpose -- though the best alternative will vary by purpose -- but it has a fairly wide range of uses for which its not intolerably bad, and its of…

I should have probably said "equally good".

Re: Transit: JSON Data Interchange Format

#123
post #104

Earlier quoted context omitted.

Ahem. http://json-schema.org/

Quoting http://json-schema.org/latest/json-schema-core.html : "This Internet-Draft will expire on August 3, 2013."

... which, by the way, does not mean that JSON Schema is bad or unusable. I actually quite like it, it has certaint elegance. Just not really standard.

Re: Transit: JSON Data Interchange Format

#124
post #121

Earlier quoted context omitted.

But no matter what format any bit of data is in, it should still be documented. Then any consumers of the data are going to have to convert it into a format that suits their language and application.

> But no matter what format any bit of data is in, it should still be documented. That's what types are: enforced documentation.

That's what types are: enforced documentation.

That's an interesting way to think about it, but I'm not sure it applies here. From the example given about money being a string or a float. A type would just enforce either or, but the consumer of the data would still need to know what it is, and convert it to whatever is necessary for them.

Post reply on HN