The Forum for Discussion about The Third Manifesto and Related Matters

Please or Register to create posts and topics.

JSON cp XML and other interchange formats: why so verbose?

PreviousPage 2 of 2
Quote from Darren Duncan on May 31, 2022, 9:00 pm

JSON also as a problem where it doesn't have just a single fully defined spec, so there are various gotchas and corner cases and different implementations behaving differently, in some respects.

I don't think that's true. RFC 8259 is the spec, there is no competition. It could be better, but it's what we've got. Any current parsers that deviate from RFC 8259 need to be fixed (and also made crash-proof of course).

See and for more about this.

Many of the parsers tested are purely of historical interest, and 3 of the parsers I use (as well as others I know of) do not appear in this list. It's interesting, but scarcely definitive.

And so what? Hand-written JSON is the exception not the rule, and provided malicious actors can do no harm, these flaws are unlikely to arise in practice. I note that there is no mention made of whether any current serialisation libraries can ever produce JSON that will cause any current JSON parsing library to fail. If not, this is a problem that isn't a problem.


Andl - A New Database Language -
Quote from Dave Voorhis on May 31, 2022, 7:18 pm
Quote from tobega on May 31, 2022, 1:47 pm


(And on the subject of YAML I have only one comment: significant whitespace, really???)

And in Python too, of course.

And Yacc/Bison: an invisible tab (moving right 8) means something different vs an invisible 8 spaces.

And Haskell/many Functional languages in which you get block structure by indentation, not needing explicit bracketing.

So because I use Haskell a lot, I set my editor to convert tabs to spaces; and then my Yacc barfs.

View > Show Symbol > Show White Space and TAB is your friend.

For similar reasons and after bad experience with Unix Make, I have a firm rule to avoid software with deceptive whitespace. Make and MUMPS are the two stand-out examples. IMO whitespace is for aesthetics (and can usually be left to the editor), not for parsing. Why is Bison a problem?

As a defensive measure I now do not write code with tabs. Life is too short. I dislike but accept indentation languages like Python. They still cause me grief at times, especially after a bit of cut and paste.

My own language Powerflex has significant whitespace in argument lists, like CoffeeScript. It was a mistake, but hard to avoid given other constraints.

Andl - A New Database Language -
PreviousPage 2 of 2