1

我正在尝试使用出色的 RestKit 框架从符合JSON API标准的 REST API 获取数据。

所有 RestKit 示例都假定对象类型被指定为对象键。
对象的示例article

{
  "articles": [
    {
      "title": "RestKit Object Mapping Intro",
      "author": "Blake Watters",
      "id": 1
    }
  ]
}

现在我想要的是像这样映射一个json响应:

{
  "data": [
    {
      "type": "articles",
      "id": "1",
      "attributes": {
        "title": "JSON API paints my bikeshed!",
        "author": "Steve Klabnik et al."
      }
    }
  ]
}

这可以用 RestKit 映射吗?如果是,如何?

4

0 回答 0