Live data from Hacker News

Better Than JSON?

wiki.alopex.li

151–153 of 153 posts

Re: Better Than JSON?

#151

Earlier quoted context omitted.

You think an instruction with Javascript in the name, that converts JavaScript floating-point to signed fixed-point, rounding towards zero, isn't used when parsing JSON?

It is, but oddly enough Javascript numbers and JSON numbers are different and mutually incompatible. JS allows ±INF and the NANs, since it uses IEEE754 double-precision floating point. JSON doesn't, and technically allows arbitrary precision floating point (though implementations are allowed to define truncation behavior to a format at least as large as an IEEE754 double).

> and technically allows arbitrary precision floating point

technically, "arbitrary precision decimal"; floating point is a storage representation, to which JSON is formally agnostic, though RFC 8259 recommends that limiting to the range and precision representable with IEEE 754 doubles is a good idea for interoperability.

Re: Better Than JSON?

#152

The list shouldn't mix those with a schema and those without. Anything using a schema that is agreed upon between participants isn't like JSON at all.

All of them use schemas, the only difference is if the syntax is specified in the language and can be machine verified or if you're left to figure it out on your own. Actually the latter will be machine verified too, but the results of a mismatch is a core dump or an error in your own ad-hoc schema verification system.

Yes I obviously meant 'specified schema' which the post describes as 'schema-defined' with the alternative being 'self-describing'.

Re: Better Than JSON?

#153

Earlier quoted context omitted.

You think an instruction with Javascript in the name, that converts JavaScript floating-point to signed fixed-point, rounding towards zero, isn't used when parsing JSON?

It is, but oddly enough Javascript numbers and JSON numbers are different and mutually incompatible. JS allows ±INF and the NANs, since it uses IEEE754 double-precision floating point. JSON doesn't, and technically allows arbitrary precision floating point (though implementations are allowed to define truncation behavior to a format at least as large as an IEEE754 double).

Yup. One of many ways that parsing JSON is anything but a simple thing is the ambiguity around how numbers, which really isn't a hard thing to get right.
Post reply on HN