5 ms·
Biggest thing about yaml for me was that you can have comments. This is very useful especially when you use it for configuration. For data interchange, I don't
by hittaruki 12y ago
Biggest thing about yaml for me was that you can have comments. This is very useful especially when you use it for configuration.
For data interchange, I don't see a lot of advantages to yaml though.
- nperez 12y agoI hadn't thought about comments - that is a clear advantage to YAML. Great point to bring up, and supports the popular view I'm seeing that YAML is maybe better for config files. I can think of numerous scenarios where a configuration decision could use some context.
- RubyPinch 12y agoOne thing that comes to mind is (for data interchange), it allows for custom objects to be explicitly marked as such http://www.yaml.org/spec/1.2/spec.html#id2805712 http://www.yaml.org/spec/1.2/spec.html#id2805712 additionally, it allows multiple top level objects in one file (which JSON can't do (not counting 3rd party modifications)) other than that, not much other use
- Ded7xSEoPKYNsDd 12y ago> additionally, it allows multiple top level objects in one file (which JSON can't do (not counting 3rd party modifications)) That's just different syntax for a top-level list of objects.
- oneeyedpigeon 12y agoFor some use cases - and configuration is a prime example - it can make sense to add the comment directly to the data, as another property of the relevant object. that then allows you to use the comment e.g. in a front-end config editor.
- collyw 12y agoI could see comments being really useful in an API.