3 ms·
The stack overflow page is disappointing because in my opinion all of the answers miss the point: Yaml is designed to be readable and editable by humans. Json i
by Patient0 12y ago
The stack overflow page is disappointing because in my opinion all of the answers miss the point: Yaml is designed to be readable and editable by humans. Json is only designed to be human readable - and intentionally does not have features to support editing by people.
Json intentionally does not support comments. Think about that for a bit and you'll realise what Json is for and what it isn't for.
As SeoxyS said: use yaml for config files, Json for APIs.
- joelthelion 12y agoWe don't need two different languages for this.
- dozzie 12y agoOh, yes, we do. We need a language targeted at humans that is machines can process and we need a language targeted at machine processing that is inspectable by humans. Those are two contradicting targets: the latter calls for simplicity, but the former calls for shortcuts[#] to make human's work easier, which adds, not reduces, complexity. [#] Shortcuts like not quoting keys and omitting braces and commas in hash definition.
- mercurial 12y agoActually, after finding out about TOML[1], I would suggest to look at it. It is a lot simpler than YAML, explicitly does not support dangerous features like deserializing arbitrary data structures, while being very readable. Spec is not entirely stable yet, though. 1: https://github.com/toml-lang/toml https://github.com/toml-lang/toml
- theyeti 12y agoAgreed. After using both YAML and TOML, I'd say that TOML is much more readable as compared to YAML.
- LoneWolf 12y agoTOML does indeed look good, reminds me of a extended .ini format
- lfender6445 12y agocan you give me dumbed down example of 'deserializing arbitrary data structures' not sure i follow
- deleted 12y ago[deleted]