HN Hall of Fame Weekly email

Parsing JSON is a Minefield

seriot.ch Essays & writing Essays & articles Security & privacy Candidate
Screenshot of seriot.ch captured 2026-07-20
Page preview · captured 2026-07-20

Resurfaced independently across 3 calendar years, with breakout response in 3 of them.

submissions
4
submitters
4
observed span
2016–2019
peak thread · 292 comments
559 pts
latest 20+ return · 2019-08-17
183 pts

Submission timeline

2007–2026

One slot for every year since HN launched. Height is that year's peak points; orange marks a 100+ point or 50+ comment breakout. Select a bar to open its strongest thread.

First comments on top threads

HN comment order

Well, first and most obviously, if you are thinking of rolling your own JSON parser, stop and seek medical attention. Secondly, assume that parsing your input will crash, so catch the error and have your application fail gracefully. This is the number one security issue I encounter in "security audited" PHP. (The second being the "==" vs. "===" debacle that is PHP comparison.) As one example, consider what happens when the code opens a session, sets the session username, then…

s_q_b·559-point thread·

While this is true of JSON, it's also true of any other non-trivial serialization and/or encoding format. The main lessons to learn here are that: 1) implementation matters 2) "simple" specs never really are It's definitely important to have documents like this one that explore the edge cases and the differences between implementations, but you can replace "JSON" in the introductory paragraph with any other serialization format, encoding standard, or IPC protocol and it would remain true: "<format> is not…

I suppose you could saw that parsing any text-based protocol in general "Is a Minefield". They look so simple and "readable", which is why they're appealing initially, but parsing text always involves lots of corner-cases and I've always thought it a huge waste of resources to use text-based protocols for data that's not actually meant for human consumption the vast majority of the time. Consider something as simple as parsing an integer in a text-based format; there may be whitespace…

The first top-level comment from each of the four biggest threads, in HN’s own order. Excerpts are shortened; open a comment for full context.

Breakout years
3

100+ points or 50+ comments

Total points
1083

reference only — not used in Hall rules or ranking

Total comments
716

reference only — not used in Hall rules or ranking

Every submission

DateTitle as submittedByPointsComments
2016-10-26Parsing JSON is a MinefieldFirst breakout · Best threadbeefburger559292
2018-04-22Parsing JSON is a Minefieldmoks339246
2019-08-08Parsing JSON Is a Minefieldtimdierks20
2019-08-17Parsing JSON Is a Minefield (2018)Latest 20+ point returnpanic183178