【发布时间】:2017-02-11 20:09:25
【问题描述】:
我试图从我从 wiki api 获得的 json 数据中获取数据
我能够准确地打印出它的架构
scala> data.printSchema
root
|-- batchcomplete: string (nullable = true)
|-- query: struct (nullable = true)
| |-- pages: struct (nullable = true)
| | |-- 28597189: struct (nullable = true)
| | | |-- ns: long (nullable = true)
| | | |-- pageid: long (nullable = true)
| | | |-- revisions: array (nullable = true)
| | | | |-- element: struct (containsNull = true)
| | | | | |-- *: string (nullable = true)
| | | | | |-- contentformat: string (nullable = true)
| | | | | |-- contentmodel: string (nullable = true)
| | | |-- title: string (nullable = true)
我要提取键“*”|-- *: string (nullable = true)的数据
请给我一个解决方案。
一个问题是
pages: struct (nullable = true)
| | |-- 28597189: struct (nullable = true)
数字 28597189 对于每个标题都是唯一的。
【问题讨论】:
标签: json scala apache-spark