It’s actually pretty nice.

Recently I’ve been reading about a lot of hate of YAML, saying that JSON or XML are far superior.

YAML has become quite popular with DevOps tools for defining your configurations because it is readable and easy to use. Everything Kubernetes seems to be YAML-based these days, so this is probably a big source of this frustration.

There are tons of complaints about the challenges of inconsistent whitespacing and it’s poor error handling. But Python, one of the most popular programming languages, also uses whitespacing and that is rarely seen as a downside. In fact, that is part of what makes it so intuitive and readable. Also, if you use any half-decent code editor this should absolutely not be an issue. As for error handling, surely that is the domain of your application, not of the config language you write it in.

Maybe it’s because I spend so much time with Python, Ansible, & Kubernetes that YAML just feels right. But to me it all comes down to the right tool for the job.

You’ll hear about all sorts of monstrosities created with generative YAML projects, but that is the fault of the people creating the projects, not YAML itself.

Sure JSON, and even XML, have their places. When I am serializing any data for an API, JSON is perfect. But YAML has it’s place too. When I am writing infrastructure configuration with Ansible or application configuration with Kubernetes, YAML gets the job done with the least headache.

Honestly though, I think everyone needs to take a chill pill and stop telling everyone how they definitively need to be doing things. What is so great about technology is how diverse it is. You can favor Ruby while I favor Python and we can both be friends. Neither one of us is right or wrong, we just have our preferences.

In that same vein, when people creating open source tools are choosing to use a markup language other than your preferred one, don’t get angry at them. They didn’t have to create the tool and open source it in the first place, but they did. If you would rather another markup language be used, contribute to it and allow for other options.

This has become a bit of a rant, but it pains me to see so much hostility in the tech world.

P.s. if you are using Kubernetes and would rather use JSON, you can totally do it. You can grab any of your K8s resources and just append -o json like kubectl get pod my-pod -o json.

Write A Comment