I want to convert string variable below to dataframe on spark.
val jsonStr = "{ "metadata": { "key": 84896, "value": 54 }}"
I know how to create dataframe from json file.
sqlContext.read.json("file.json")
but I don't know how to create dataframe from string variable.
How can I convert json String variable to dataframe.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…