Skip to content
Related Articles
Open in App
Not now

Related Articles

Python JSON

Improve Article
Save Article
  • Difficulty Level : Medium
  • Last Updated : 09 Dec, 2020
Improve Article
Save Article

JSON JavaScript Object Notation is a format for structuring data. It is mainly used for storing and transferring data between the browser and the server. Python too supports JSON with a built-in package called json. This package provides all the necessary tools for working with JSON Objects including parsing, serializing, deserializing, and many more. Let’s see a simple example where we convert the JSON objects to Python objects and vice-versa.



import json
# JSON string
employee = '{"id":"09", "name": "Nitin", "department":"Finance"}'
# Convert string to Python dict
employee_dict = json.loads(employee)
# Convert Python dict to JSON
json_object = json.dumps(employee_dict, indent=4)


 {'id': '09', 'name': 'Nitin', 'department': 'Finance'}
<class 'dict'>

    "id": "09",
    "name": "Nitin",
    "department": "Finance"
<class 'str'>

This JSON Tutorial will help you learn the working of JSON with Python from basics to advance, like parsing JSON, reading and writing to JSON file, serializing and deserializing JSON using a huge set of JSON programs.


Reading and Writing JSON

Parsing JSON

Serializing and Deserializing JSON

Conversion between JSON

More operations JSON

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!