【发布时间】:2017-05-03 08:56:08
【问题描述】:
使用 swift vapor 和 elasticsearch,得到如下响应:
{
"_shards": {
"failed": 0,
"successful": 5,
"total": 5
},
"hits": {
"hits": [
{
"_id": "3",
"_index": "items_v1",
"_score": 1.2029922,
"_source": {
"property1": "test",
"property2": "another test",
...
},
"_type": "item"
},
...
在“hits”->“hits”->“_source”中,我得到了模型“Item”的所有属性。如何从这个 json 响应中创建一个 Items 数组“[Item]”?
【问题讨论】:
标签: arrays swift elasticsearch swift3 vapor