【发布时间】:2020-03-05 02:20:21
【问题描述】:
我有嵌套的 JSON(行)文件,看起来像
[{"ok":2, "nested": {"meh":2, "hehe":{"a":1, "b":2 }}},
{"ok":3, "nested": {"meh":10, "hehe":{"a":1, "b":2}}},
{"ok":4, "nested": {"meh":11, "hehe":{"a":1, "b":2}}}]
...
我希望将其取消嵌套到 data.frame 表示的 CSV 表单中
ok, nested.meh, nested.hehe.a, nested.hehe.b
2, 2, 1, 2
3, 10, 1, 2
4, 11, 1, 2
...
我试过了
a = jsonlite::read_json("file.json")
然后是列表列表,似乎需要自定义编码才能取消嵌套,但我想读取一般嵌套文件。有包来处理这个吗?我查看了rlist 的文档,但找不到信息,因为rlist::table 不起作用。
【问题讨论】: