【发布时间】:2014-01-04 14:50:22
【问题描述】:
在 JSON 文件中,文件中的每个对象都由不同类型的 JSON 元素组成。 (整数、字符串、数组、对象数组等)
我的目标是列出所有元素名称和相应的类型。我可以知道如何在 Gson 中做到这一点吗?这样做的目的是创建 Hive 架构。
例子:
{
"number": 1,
"ts": "1386848002",
"cmpg": [
{
"id": 476,
"mcp": 0,
"deals": [ ],
"cookie": "uid:123",
"bid": [
{
"bId": 0,
"status": "ZB",
"rmtchID": -1
}
]
}
]
}
输出:
number int,
ts String,
cmpg array<map<String, Object>> // not sure how to interpret this...
【问题讨论】:
标签: java arrays json hive gson