Read and parse JSON in Python

visibility 113 access_time 8 months ago languageEnglish timeline Stats
timeline Stats
Page index 0.10

JSON is commonly used in modern applications for data storage and transfers. Pretty much all programming languages provide APIs to parse JSON. 

In Python, you can use json package to parse JSON. Function loads can be used to convert a string object to a JSON object.

Install the package via Pip:

pip install json

Code snippet

import json

jsonStr="""
{"Name":"A","Value":2}
"""
print(jsonStr)

json_obj = json.loads(jsonStr)
print(json_obj["Name"])
print(json_obj["Value"])
info Last modified by Raymond 8 months ago copyright This page is subject to Site terms.

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

expand_more
Read and Write Files via Python

More from Kontext
Spark - Save DataFrame to Hive Table
visibility 63,997
thumb_up 12
access_time 2 years ago
Data Operations with SQLite Database via Python
visibility 375
thumb_up 0
access_time 2 years ago
Pandas DataFrame Plot - Bar Chart
visibility 9,120
thumb_up 0
access_time 2 years ago
Pandas DataFrame Plot - Bar Chart