Table of contents
JSON in Python
In Python, JSON (JavaScript Object Notation) is a popular data format used for exchanging data between a server and a web application, or between different systems. It provides a lightweight and human-readable way of representing structured data.
The json
module in Python provides functions for working with JSON data. Here's a brief overview of how you can use JSON in Python.
Importing the json module: import json
Converting JSON to Python objects: The json
module provides the json.loads()
function to parse a JSON string
YAML in Python
YAML, a recursive acronym for “YAML Ain’t Markup Language,” is a human-readable data serialization language. It is often used for configuration files but also for data exchange. The most used Python YAML parser is PyYAML, a library that allows you to load, parse, and write YAML, much like Python’s JSON library helps you to work with JSON.
Tasks:
Create a Dictionary in Python and write it to a JSON File.
Read a JSON file
services.json
kept in this folder and print the service names of every cloud service provider.output
aws: ec2
azure: VM
gcp: compute engine
Read YAML files using Python, file
services. yaml
and read the contents to convert yaml to jsonDay 15 task is completed!
Happy learning!!!!