我有一个json文件,其中包含来自pojo的数据,基本上是
String
Map<String, Set<OBJ>>
=&GT;对象有哪些
int
int
string
timestamp
以下是一个示例行: { “键”: “123qwe123”, “属于MapData”:{ “3539”:[{ “ID”:36, “类型”:1, “OS”: “WINDOWS”, “lastSeenDate”:“2015年6月3日22:46:38 UTC“}],”16878“:[{”id“:36,”type“:1,”os“:”WINDOWS“,”lastSeenDate“:”2015-06-03 22:26: 34 UTC“}],”17312“:[{”id“:36,”type“:1,”os“:”WINDOWS“,”lastSeenDate“:”2015-06-03 22:26:48 UTC“} ]}}
我尝试执行以下架构,但那不起作用:
[ { "name" : "key", "type" : "string" }, { "name" : "mapData", "type" : "record", "mode": "repeated", "fields": [ { "name": "some_id", "type": "record", "mode" : "repeated", "fields" : [ { "name": "id", "type": "integer", "mode": "nullable" }, { "name": "type", "type": "integer", "mode": "nullable" }, { "name": "os", "type": "string", "mode": "nullable" }, { "name": "lastSeenDate", "type": "timestamp", "mode": "nullable" } ] } ] } ]
当我运行时我得到:重复记录必须作为JSON数组导入 我知道有些东西与架构有关,但尚未弄清楚。