The JSON format is also simple and easy to read for users, but more program-friendly. Because it has data types (number, string, Boolean, and object), it is popular to exchange the data between systems. Technically, YAML is a superset of JSON, so JSON is a valid YAML, but not the other way around. To know more about JSON, you can refer to the following website link: http://json.org/.
The following example of the Pod is the same as the preceding YAML format, but using the JSON format:
$ cat nginx-pod.json
{
"apiVersion": "v1",
"kind": "Pod",
"metadata": {
"name": "my-nginx",
"labels": {
"env": "dev"
}
},
"spec": {
"containers": [
{
"name": "my-nginx",
"image": "nginx",
"ports": [
{
"containerPort": 80
}
]
}
]
}
}