# Day 15 : Python Libraries for DevOps

### **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.**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695646996291/45a601f4-5db5-494c-8bcc-920c33dc9f35.png align="center")

### **2.Read a JSON file** `services.json` **shown below and print the service names of every cloud service provider.**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695723492598/6ce397de-0183-4ad7-8c31-b9bb2d56379e.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695724506989/89e5effc-1684-4faf-a1ff-9401bc11d133.png align="center")

**Output**:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695724608468/fc08ae07-4f57-4470-81cc-4e83d8a200fc.png align="center")

### **3.Read YAML file using Python, file** `services.yaml` **and read the contents to convert YAML to JSON**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695724690989/244c2731-c7b1-420c-9b64-d0c20b561766.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695724716544/ec9d4910-823a-4f62-977c-2e53431366d3.png align="center")

**Output:**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695724648438/94a68da4-fc79-4332-8e6a-87b37cf06a4b.png align="center")
