DEV Community

Shahriyar Al Mustakim Mitul
Shahriyar Al Mustakim Mitul

Posted on

DevOps Prerequisite (Part 7): YAML & Json

This is how YAML file looks:

Image description

Image description
Dictionaries

Image description
Moreover, order matters in list but it does not matter in dictionary

Image description

Take this quiz

Json and Json Path

In Json, things are bit different. Using brackets like 2nd bracket and third one.

Here you can see yaml used spaces and json used "{}"

Image description
For lists, yaml uses "-" where as json uses "[]"

Image description

Use this Json to Yaml converter
Json Path

Query language applied in json or yaml format.

Image description

Image description

If there is no dictionary mentioned, it means root dictionary and we use $ in json path to mean that.

Image description
The results will be in square brackets.

Image description

This is how we use indexing here.

Image description

Image description
We can also find numbers greater than 40 by this:

Image description

Here ? means check if
@ means each item and others are conditions like (> , ! etc)

We could also filter car models using their locations by this

Image description

here, @.location means checking each item's(index 0,1,2,3) location and then if they find a value of rear-right in any location, that is the desired item.
Here our desired item is index 1 and then we get the value of the model.

Take part in the labs
Just like this...
Image description
After successfully completing these,

Image description

You can also do a free course from KodeKloud

Latest comments (0)