Get the latest tech news

JSON is not a YAML subset (2022)


People on the internet believe that JSON is a subset of YAML, and that it's safe to parse JSON using a YAML parser: Following this advice will end badly because JSON is not a subset of YAML. It is easy to construct JSON documents that (1) fail to parse as YAML, or (2) parse to valid but semantically different YAML.

Following this advice will end badly because JSON is not a subset of YAML. This behavior produces surprising outcomes, and has been named The Norway Problem. A similar issue affects JSON documents passed to a YAML parser when dealing with numbers in exponential notation.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of json

json

Photo of yaml

yaml

Related news:

News photo

Show HN: Rewindtty – Record and replay terminal sessions as structured JSON

News photo

From XML to JSON to CBOR

News photo

3-JSON