0 votes
1 view
in Python by (15.9k points)
edited by

How do I parse a JSON file in python to read data from it?

1 Answer

0 votes
by (25.1k points)

Python has a built in module named 'json'. You can use it to parse json data.

Since you have your json data in a file all you have to do is read the file and parse it using json module.

Also you can make the output pretty by using the pprint method.

You can do it like this:

import json

from pprint import pprint

data = json.load(open('data.json'))


You can learn more about python using this video:

Related questions

0 votes
1 answer
0 votes
1 answer
asked Jul 13 in Python by ashely (43k points)
0 votes
1 answer
asked Jul 2, 2019 in Python by Sammy (47.8k points)
+2 votes
2 answers
Welcome to Intellipaat Community. Get your technical queries answered by top developers !