import pandas as pd
df=pd.read_json("student.json")
print(df)
Output is here
class id mark name sex
0 Four 1 75 John Deo female
1 Three 2 85 Max Ruin male
2 Three 3 55 Arnold male
3 Four 4 60 Krish Star female
4 Four 5 60 John Mike female
------------
------------
read_json(): DataFrame from JSON
This will read the data from json file ( in same directory ) student.json
We can read the URL also.
import pandas as pd
df=pd.read_json("https://www.plus2net.com/php_tutorial/student.json")
print(df)
It can be your localhost also.
import pandas as pd
df=pd.read_json("http://127.0.0.1/student.json")
print(df)
Options
We can generate JSON ( to_json() )by using various orient options and while reading we can maintain the same orient option.