r/sysadmin • • May 19 '20
Microsoft 📢 Windows Package Manager | winget.exe
[deleted] — view deleted post
384
Upvotes
r/sysadmin • • May 19 '20
[deleted] — view deleted post
View all comments
Show parent comment
4
u/BadgersInSpace May 20 '20
Because all valid YAML is convertible to valid JSON and vice versa. It's more natural and faster (for me at least) to write something in YAML than in JSON and the whitespace makes it easy to read and makes it look consistent across editors or applications vs having to pretty-print JSON output because 9 times out of 10 it's going to have the whitespace stripped.
I interact with it on a day to day basis for configuration files, and one of the most useful things is the ability to create multi-line strings with |. Trying to do that in JSON requires manual escaping of the newlines, quotes, etc. which would be a nightmare for passing in the text of a Python script, for example, to a content parameter of a Puppet file resource.
YAML is for humans to write something to tell the machine something, where JSON is machine-speak for talking to other machines that is intelligible to humans and can be spoken relatively easily if a human needs to initiate a machine is my interpretation.
Extending that comparison, XML is speaking proper Formal English constantly, which gives you the exact unambiguous specifics... in three times as long as it would have taken to say it in vernacular.
tl;dr less of a pain in the ass to write something in YAML over JSON, and fuck XML