Ember data: Your server returned a hash with the key 0 but you have no mapping for it

前端 未结 3 1590
名媛妹妹
名媛妹妹 2021-01-21 12:07

I have a simple model and use the RESTadapter to get the data. The JSON request is executed, but then I receive the following error: \"Your server returned a hash with the key

3条回答
  •  青春惊慌失措
    2021-01-21 13:04

    The JSON you are looking for should have a root element

    {"articles": [ 
      { 
        "id": 1,
        "title": "Title 1"
      },
      {
        "id": 2,
        "title": "Title 2"
       }
      ]
    }
    

    You can find documentation in the Ember Docs RESTAdapter or at the JSONapi project

提交回复
热议问题