-werners-
Esteemed Contributor III

What I was trying to say is that json.loads will not work on a spark column (I was not very clear).

It is not just a list of values. So the for-loop will not work.

Instead you should use a spark function to check the validity of the json string, f.e. to_json.

And what I mean by passing in the df as a function parameter is just def is_json(df, ...).

It is sometimes necessary to work with column names (so not the column itself but only the name) and also with the col itself (so the actual df-column with the values).

If that is the case you also have to put the DF into the picture.