+------------------------------------------------------------------+
| message |
+------------------------------------------------------------------+
|{"name":"east-desktop","viewers":447,"emptyCount":0,"version":0.3}|
|{"name":"west-desktop","viewers":111,"emptyCount":0,"version":0.6}|
|{"name":"west-desktop","viewers":115,"emptyCount":0,"version":0.1}|
+------------------------------------------------------------------+
message:string
I have a dataframe which contains json data within one column, I would like to extract the data in to either separate columns or as json file.
I am working within a Databricks notebook using pyspark.
Dataframe
+---------------------------------------------+
| name | viewers| emptyCount | version |
+---------------------------------------------+
|east-desktop | 447 | 0 | 0.3 |
|west-desktop | 111 | 0 | 0.6 |
|west-desktop | 115 | 0 | 0.1 |
+---------------------------------------------+
OR Json
{
"name": "east-desktop",
"viewers": 447,
"emptyCount": 0,
"version": 0.3,
}