Pyspark: Best way to set json strings in dataframe column

Viewed 25

I need to create couple of columns in Dataframe where I want to parse and store the json string. Here is one json which I need to store in one column. Other json are also similar.Can you please help in how to transform and store this json string in the column. The values section needs to be filled from the values from other dataframe columns within the same data frame.

{
  "name": "",
  "headers": [
    {
      "name": "A",
      "dataType": "number"
    },
    {
      "name": "B",
      "dataType": "string"
    },
    {
      "name": "C",
      "dataType": "string"
    }
  ],
  "values": [
    [
      2,
      "some value",
      "some value"
    ]
  ]
}
0 Answers
Related