SpinTheMic
Pro

Interview practice question

Reading nested JSON in Spark

Data Engineering · Spark · Beginner

You receive JSON files with nested objects and arrays. How do you flatten them into a table with PySpark?

What a strong answer covers

Your AI report card counts how many of these ideas you cover.

  • Read with spark.read.json and an explicit schema if possible.
  • Access nested fields with dot notation like col('address.city').
  • Use explode or explode_outer for arrays.
  • Alias columns to clean names.
  • Keep the raw JSON in bronze for reprocessing.
Practise this topic

Start without signing up. Sign in free to get an AI report card on your answer.

See all topics