Class DS.Serializer

Extends: EmberObject
Defined in: addon/serializer.js:7
Module: ember-data

DS.Serializer is an abstract base class that you should override in your application to customize it for your backend. The minimum set of methods that you should implement is:

  • normalizeResponse()
  • serialize()

And you can optionally override the following methods:

  • normalize()

For an example implementation, see DS.JSONSerializer, the included JSON serializer.

Show:

Module: ember-data

The store property is the application's store that contains all records. It can be used to look up serializers for other model types that may be nested inside the payload response.

Example:

1
2
3
4
5
6
7
Serializer.extend({
  extractRelationship(relationshipModelName, relationshipHash) {
    var modelClass = this.store.modelFor(relationshipModelName);
    var relationshipSerializer = this.store.serializerFor(relationshipModelName);
    return relationshipSerializer.normalize(modelClass, relationshipHash);
  }
});