PySpark SQL functions json_tuple
can be used to convert DataFrame JSON string columns to tuples (new rows in the DataFrame).
Syntax of this function looks like the following:
pyspark.sql.functions.json_tuple(col, *fields)
The first parameter is the JSON string column name in the DataFrame and the second is the filed name list to extract.
If you need to extract complex JSON documents like JSON arrays, you can follow this article - PySpark: Convert JSON String Column to Array of Object (StructType) in DataFrame.
Output
StructType([StructField('id', LongType(), True), StructField('c0', StringType(), True), StructField('c1', StringType(), True), StructField('c2', StringType(), True)]) +---+---+------+----------+ | id| c0| c1| c2| +---+---+------+----------+ | 1| 1|10.201|2021-01-01| | 2| 2|20.201|2022-01-01| +---+---+------+----------+