5 ms·
JSON is a subset of YAML anyway. So anything that accepts YAML can deal with JSON, and you can convert one to the other.
by zozbot234 4y ago
JSON is a subset of YAML anyway. So anything that accepts YAML can deal with JSON, and you can convert one to the other.
- krapp 4y ago>JSON is a subset of YAML anyway. It isn't, really. A conforming YAML parser will not treat JSON data the same way that a JSON parser will in all cases. [0,1] The only correct way to deal with JSON is using a JSON parser. [0]https://john-millikin.com/json-is-not-a-yaml-subset https://john-millikin.com/json-is-not-a-yaml-subset [1]https://news.ycombinator.com/item?id=31406473 https://news.ycombinator.com/item?id=31406473
- nerdponx 4y agoIs the "%YAML 1.2" directive necessary? Seems like something that you should be able to turn on in a YAML parsing library.
- moffkalast 4y agoWait, can pyyaml actually parse json? I highly doubt it.