Same JSON, Six Parsers, 19 Divergent Outcomes: A Developer's Stress Test
A developer fed 24 deliberately tricky JSON documents to six popular parsers — Python, Node.js, Ruby, Perl, jq, and Swift — and found that only five of the 24 documents produced identical results across all six. Key divergences included duplicate object keys, where five parsers kept the last value while Swift kept the first, creating a potential security gap in systems where two services read the same payload differently. Node.js silently truncated large integers beyond 2^53 due to IEEE 754 floating-point limits, with no error or warning, a common source of database ID corruption. Several documents were accepted by some parsers and rejected by others, including lone Unicode surrogates, trailing commas, and numbers like NaN or Infinity, which are not valid JSON. The findings highlight that RFC 8259 leaves enough ambiguity for individually correct parsers to behave in ways that break cross-service pipelines in practice.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.



Discussion (0)
Log in to join the discussion and vote.
Log in