Parsing JSON Is a Minefield (2018)
I suppose you could saw that parsing <i>any</i> text-based protocol in general &quot;Is a Minefield&quot;. They look so simple and &quot;readable&quot;, which is why they&#x27;re appealing initially, but parsing text always involves lots of corner-cases and I&#x27;ve always thought it a huge waste of resources to use text-based protocols for data that&#x27;s not actually meant for human consumption the vast majority of the time.<p>Consider something as simple as parsing an integer in a text-based format; there may be whitespace to skip, an optional sign character, and then a loop to accumulate digits and convert them (itself a subtraction, multiply, and add), and there&#x27;s still the questions of all the invalid cases and what they should do. In contrast, in a binary format, all that&#x27;s required is to read the data, and the most complex thing which might be required is endianness conversion. Length-prefixed binary formats are almost trivial to parse, on par with reading a field from a struture.