cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Reading multi-dimensional json files

AndriusVitkausk
New Contributor III

So I've been having some issues reading a json file that's been provided to the business with another nesting layer, so instead of a json being an:

  • 'array of objects' -> [ {} ,{} ,{} ]
  • It's an 'array of arrays of objects' -> [ [ {}, {} ,{} ], [ {} ,{} ,{} ] ]

While the first is alright to read with the multiline option with spark, the second case simply comes with the correct column schema, thought every columns is just a null value (actual file content looks good)

I've so far tried to create a custom struct schema to deal with the extra layer, but not had any luck to get it to work. Just returns nulls.

Is there something obvious that i'm missing?

1 REPLY 1

ashish1
New Contributor III

You can use the explode function to flatten the array to rows, can you post a simple example of your data?

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!