YAML vs TOML vs JSON vs XML
I’ll make this easy. Use whatever you have to, but if you have a choice your default should always be JSON unless:
- you are 100% sure the data will only be edited by hand, and
- you have data that contains lots of line returns.
YAML parser support — compared to JSON — is weak to say the least. It is impossible to programmatically alter YAML and have the exact same file result. This is why you have to be 100% sure you will never be changing the YAML data with anything other than a text editor — which is rather rare and dangerous assumption these days. It is likely no matter how confident you are that you will some day need to automate some small change and the only practical way to do that is to switch to JSON. Save yourself a massive data porting effort and just go with JSON to begin with.
💎 If you have line returns and textual data in your structured data files like YAML and JSON — that you are also required to edit by hand — you likely have some seriously bad design in your application. It is better to put such thing into separate Markdown files and refer to them.
XML and TOML have very specific usage but will never be as good as JSON for most structured data. That is why JSON is the lingua franca of the Internet.