Table of contents
JSON and YAML in Python
JSON: The full form of JSON is JavaScript Object Notation. JSON is a lightweight data format for data interchange that can be easily read and written by humans, easily parsed, and generated by machines. Python has a built-in package called json.
YAML: The full form of YAML is Yet Another Markup Language. It is a lightweight, human-readable data-representation language. Since YAML is a superset of JSON, it can parse JSON with a YAML parser. The extensions in YAML are .yaml or .yml.
1.Create a Dictionary in Python and write it to a JSON File.
2.Read a JSON file services.json
shown below and print the service names of every cloud service provider.
Output:
3.Read YAML file using Python, file services.yaml
and read the contents to convert YAML to JSON
Output: