Python Processing JSON Data
JSON stands for the JavaScript Objects Notation. Usually it is a text file which is easily read by the human. Its is a Lightweight format, it is used when data is sent to another via server. Pandas provides the read_json function to reads the json file.
JSON file
{"SR":["1","2","3","4","5" ], "Name":["Ram","Shyam","Mohan","Sohan","Geeta"], "Roll":["001","002","003","004","005" ], "AdmissionDate":[ "1/7/2020","1/7/2020","1/7/2020","1/7/2020","1/7/2020"], "Class":[ "7”,"7","7","7","7"]}
This file is the demonstration of the JSON .this file save as info.json
Reading JSON File
- Upload File
- Decode the File
- Parse file
import json fro m google.colab import files uploaded = files.upload()
Output
import io data = "information.json" io.StringIO(uploaded[data].decode("utf-8"))
Output
json.loads(uploaded[file_name].decode("utf-8"))
Output