cancel
Showing results for 
Search instead for 
Did you mean: 
Get Started Discussions
Start your journey with Databricks by joining discussions on getting started guides, tutorials, and introductory topics. Connect with beginners and experts alike to kickstart your Databricks experience.
cancel
Showing results for 
Search instead for 
Did you mean: 

Attempting to load a JSON file fails due to schema issue (Free Edition)

chris84
New Contributor

Hello,

I created a Volume named 'test_volume' under catalog:workspace and schema:default.

Then I uploaded a file named user_0.json into test_volume (fake data, of course):

chris84_1-1767792178558.png

Now I want to load that file into a data frame.

With Python in a notebook:

chris84_0-1767792125532.png

With SQL:

chris84_2-1767792435608.png

Apparently there is a problem with the schema. But how is that possible given how primitive the JSON object is?

What am I doing wrong here?

Thanks

2 REPLIES 2

chris84
New Contributor

The JSON file I uploaded contained the JSON object pretty printed (multiple lines and spaces for indentation). After removing those (single line), it works.

JAHNAVI
Databricks Employee
Databricks Employee

@chris84 Could try using spark.read .option("multiline", "true").json("volume_path") in pyspark 

Jahnavi N

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now