How to install JSON in Python

JSON, stands for JavaScript Object Notation, is a lightweight data-interchange format. It is often used for exchanging data between a web server and user agent.
json is a built-in module in Python, you don’t need to install it with pip.
The json library can parse JSON from strings or files. The library parses JSON into a Python dictionary or list. It can also convert Python dictionaries or lists into JSON strings.
Let’s see an example of how JSON parsing works:
import json json_string = '{ "1":"Red", "2":"Blue", "3":"Green"}' parsed_json = json.loads(json_string) print(parsed_json['1'])
Output:
Red
Subscribe
Login
Please login to comment
0 Discussion