我需要把多个json文件读入spark-df。json数据如下所示:
{"f0_":{"id":"138307057680","ActionName":"Complete","Time":"2020-04-23-12:40:04"}}
{"f0_":{"id":"138313115245","ActionName":"Midpoint","Time":"2020-06-16-20:41:16"}}
我需要去掉第一个包含所有列的键。我试过:
jsonFiles = spark.read.json("Resources") # path to all json files
jsonFile.printSchema()
输出为:
root
|-- f0_: struct (nullable = true)
| |-- id string (nullable = true)
| |-- ActionName: string (nullable = true)
| |-- Time: string (nullable = true)
1条答案
按热度按时间c9x0cxw01#
这对你来说是一个有效的解决方案----
在此处创建Dataframe
此处输出