
JSON vs YAML: Know Both, Convert Between Them Effortlessly
Kubernetes uses YAML. CloudFormation uses both JSON and YAML. Docker Compose uses YAML. GitHub Actions uses YAML. CI/CD pipelines use YAML. Meanwhile, APIs speak JSON, JavaScript objects are JSON-like, and package.json is, well, JSON. As a developer, you constantly shift between these two serialization formats. They represent the same data structures but with different syntax philosophies: JSON uses braces and brackets with explicit delimiters; YAML uses indentation with minimal syntax. The same data in both formats JSON: { "apiVersion" : "apps/v1" , "kind" : "Deployment" , "metadata" : { "name" : "web-app" , "labels" : { "app" : "web" } }, "spec" : { "replicas" : 3 , "template" : { "spec" : { "containers" : [ { "name" : "web" , "image" : "nginx:1.24" , "ports" : [{ "containerPort" : 80 }] } ] } } } } YAML: apiVersion : apps/v1 kind : Deployment metadata : name : web-app labels : app : web spec : replicas : 3 template : spec : containers : - name : web image : nginx:1.24 ports : - cont
Continue reading on Dev.to DevOps
Opens in a new tab



