Class DS.Serializer
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:
extract()
serialize()
And you can optionally override the following methods:
normalize()
For an example implementation, see DS.JSONSerializer, the included JSON serializer.
extract (store, typeClass, payload, id, requestType) Object
Defined in packages/ember-data/lib/system/serializer.js:63
- store
- DS.Store
- typeClass
- DS.Model
- payload
- Object
- id
- (String|Number)
- requestType
- String
- returns
- Object
The extract
method is used to deserialize the payload received from your
data source into the form that Ember Data expects.
normalize (typeClass, hash) Object
Defined in packages/ember-data/lib/system/serializer.js:93
- typeClass
- DS.Model
- hash
- Object
- returns
- Object
The normalize
method is used to convert a payload received from your
external data source into the normalized form store.push()
expects. You
should override this method, munge the hash and return the normalized
payload.
serialize (record, options) Object
Defined in packages/ember-data/lib/system/serializer.js:77
- record
- DS.Model
- options
- Object
- returns
- Object
The serialize
method is used when a record is saved in order to convert
the record into the form that your external data source expects.
serialize
takes an optional options
hash with a single option:
includeId
: If this istrue
,serialize
should include the ID in the serialized object it builds.