Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Python JSON

  • Last Updated : 09 Dec, 2020

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.


 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course


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
Recommended Articles
Page :

Start Your Coding Journey Now!