JSON stands for JavaScript Object Notation. It’s a lightweight data format used for exchanging data between systems — often between a
client (browser) and a server (backend).
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
Example of JSON:
JSON in Python
Python provides a built-in module called
jsonto work with JSON data.You can use it to:
1. Convert Python object to JSON string
Use
json.dumps()Output:
2. Convert JSON string to Python object
Use
json.loads()Output:
3. Read/Write JSON file
Write to file:
Read from file:
Supported Data Types
Extra Tip – Pretty Print JSON
You can make JSON output more readable using
indent:Output: