access_time 3 years ago languageEnglish
more_vert

Read and parse JSON in Python

visibility 71 comment 0

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 Administrator 11 months ago copyright This page is subject to Site terms.
Like this article?
Share on

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

Follow Kontext

Get our latest updates on LinkedIn.

Want to contribute on Kontext to help others?

Learn more

More from Kontext

Kafka Topic Partitions Walkthrough via Python
visibility 2825
thumb_up 1
access_time 11 months ago
Load XML File into BigQuery
visibility 149
thumb_up 0
access_time 3 months ago