Prajapathy_NKR
Contributor

@szymon_dybczak your solution was crisp.

@SuMiT1 since you have mentioned your json is dynamic, get one of your json body into a variable. 

json_body = df.select("content").take(1).collect(0)

then get the schema of the json,

schema = schema_of_json(json_body)

use this schema while extracting you json using from_json.

hope this helps.