I am trying to read the JSON file in pyspark. When tried to read as df it is reading but when asked to display its shows up an error:-
df = spark.read.format("json") \
.load(path)
df.show()
error:
AnalysisException: Since Spark 2.3, the queries from raw JSON/CSV files are disallowed when the
my JSON data looks as follows:-
[
{
"Rollno": 19,
"sex": "female",
"Rank": 9,
"Date": "11/12/2020"
},
{
"Rollno": 18,
"sex": "male",
"bmi": 7,
"Date": "11/12/2020"
},
and so on.
Why am I getting this error? Am I reading it incorrectly? What is the best way to read and display a JSON file?