Ember.js REST Adapter without JSON root

后端 未结 5 1301
Happy的楠姐
Happy的楠姐 2020-12-06 18:56

The Ember.js REST Adapter expects the JSON to be returned as:

{
    \"person\": {
        \"first_name\": \"Barack\",
        \"last_name\": \"Obama\",
              


        
5条回答
  •  温柔的废话
    2020-12-06 19:31

    The easiest way is to not use the RESTSerializer but the much simpler JSONSerializer, which does not expect a root element.

    Good resources on understanding which serializer to use for a given API can be found in these two blog posts:

    http://thejsguy.com/2015/12/05/which-ember-data-serializer-should-i-use.html
    http://emberigniter.com/fit-any-backend-into-ember-custom-adapters-serializers/

提交回复
热议问题