The first time I came across YAML was around a year ago when I use it to write OpenAPI definitions to document a RESTful API using Swagger API Docu...
For further actions, you may consider blocking this person and/or reporting abuse
Thanks for all the tips and tricks. I like using YAML for configurations.
PS: YAML has some default casting one should be aware of:
Thank you! According to the YAML 1.2 specification document 'yes' and 'no' are no longer interpreted as boolean.
You can use !!bool to parse them, though.
Thanks for this! I just got started with GitHub Actions a couple of days ago, and was making a lot of assumptions on what the YAML was representing -- the translations to JSON you've done here are really helpful :)
Thanks Darren, I'm glad I could help! 🙂
I used YAML file to configure Cluster group in the Pipeline during my internship this past Summer. It was a bit challenging since this was the first time using it but definitely easy to work with. Thanks for sharing this great article.
Nice! Was it your first time working with it? And did its readability made it easier to pickup?
I use YAML for my default config files with tools such as ESLint and Stylelint. I find the syntax a lot more intuitive than JSON and I am less likely to make mistakes with it.
Thank you for making this tutorial, Paula.
Nice! Do you mind sharing a bit more about how you use it? Like which language and do you use a parser?
I'm really curious because I love the syntax, but I don't like the idea of including extra dependencies just for that.
I currently use yaml only when a node js package offers built-in support for it. I stick with json, otherwise. I don't know much about parsers as I've only used babel before and it doesn't support yaml, as far as I know.
I use YAML so often on Jekyll.. and I didn't know I could write multiline strings just by add this
|
. Amazing. Thanks.Something I forgot to include about strings is that you can also write multiline strings that you don't want to be interpreted as multiline. For example:
And this is how it'll look like in JSON:
When using the
>
character, instead of|
, each new line will be interpreted as an empty space.I'm glad! Thanks for reading :D
Hi, Paula. Great article!
I have one question, in JSON we can easily create a list of objects without “naming” them, like this:
[{“a”: “b”}, {“x”: “y”}]
How we do that in YAML? For example, a list of Authors (I don’t wanna have [{“authors” : {authoObj1}}, {“authors” : {authoObj2}}])
Great question!
You can achieve that by entering the hyphen first and then the properties in a new line, like so:
Which will translate to JSON as:
Also here's a nice online tool I've been using to try the YAML syntax and see its JSON counterpart.
I used YAML for my uni assignment where we had to build a ci/cd pipeline using Travis CI for a spring boot application. Travis uses a YAML file for configuration and I found it very easy and intuitive to work with.
Nice! Every CI pipeline config I've seen so far uses YAML. I believe we'll be seeing more of it in the near future.
Thanks for this helpful article. I'm using it in K8s to setup the values files and sort of understood the basics of YAML - but this was legit lightbulb. I don't know why I didn't consider that it can be translated to JSON! Thanks again
Thanks for all the tips and tricks!!
I discovered Yaml accidentally, I am learning star and I met him, and also with the link to your article and this beautiful community, this is for me a day of pleasant discoveries.
I ran into YAML when working with AWS CloudFormation. It beat me up like a drum 😒
Believe me, I know the feeling!😂
One of the things that made me change my mind after reading about it for a bit was that the whole concept behind YAML made me remember how I felt after going from XML to JSON, which was basically "wow, so much less code, I can actually read this!".
I use yaml for Puppet and Ansible
I didn't know any of those so I had to do a quick search. Sounds interesting!
I use it since Jekyll themes use it as configuration data(front matter). As you described, at first glance it seemed weird but once you spend some time, you get used to it.
Yes! Once I found out I could use comments and felt confortable enough to structure the info however I liked I realized how easy it was.
I've been using YAML for the last 2 years and I've completely ignored learning anything about it. This was a good beginning.
Thanks
Same here 😂. Its focus in readability makes it easy to pickup without actually learning it, but I always felt a bit uncomfortable with it until I wrote this, I also hated having to google specific stuff like "multi-line strings in yaml".
Super
Thanks!
Yay thanks for that post, I've been using it slightly but happy to have learned something on it!
Great! I'm glad I could help :)
I start using YAML in docker and from that time I find it so useful and simple it makes me feel I read an article, not a data file.
Thanks Paula for this amazing article.
Thank yo Mahmoud!
I've been meaning to get into docker, maybe after learning about YAML it'll be easier.
Docker Compose to be precise ✌️✌️✌️
Nice Article! But now JSON also support reusability with "key" : $ref
Hey yamlonline.com/
checkout this editor for YAML to JSON
try it!!
So YAML does for JSON what Markdown did for HTML.
But I'm no fan of YAMLs "no tabs" rule or the "as many spaces as you want" rule. Seems a odd choice backed by a flimsy excuse.
I found those a bit odd too at first. However, the YAML specification addresses the no tab rule:
And I found that to be true for VSCode at least.
And about the number of spaces, I just handle that myself and keep it consistent. Haven't had an issue with that, to be honest.
Hey checkout this yamlonline.com/
It's a nice tools for YAML to JSON try it!!