I encountered a similar issue recently when reading json file with a shcema. After investigation, I discovered that the root cause was a mismatch between the expected and actual schema. To resolve this, I recommend the following approach:
Print out the expected schema for reference.
Load the JSON file into Spark, allowing it to infer the schema automatically.
Compare the inferred schema with the expected one to identify any discrepancies.