DS.JSONSerializer#serializeHasMany()

serializeHasMany (snapshot, json, relationship) Defined in addon/serializers/json.js:1206 serializeHasMany can be used to customize how DS.hasMany properties are serialized. Example app/serializers/post.js import DS from 'ember-data'; export default DS.JSONSerializer.extend({ serializeHasMany: function(snapshot, json, relationship) { var key = relationship.key; if (key === 'comments') { return; } else { this._super.apply(this, arguments); } } }); Paramet

DS.JSONSerializer#serializeBelongsTo()

serializeBelongsTo (snapshot, json, relationship) Defined in addon/serializers/json.js:1153 serializeBelongsTo can be used to customize how DS.belongsTo properties are serialized. Example app/serializers/post.js import DS from 'ember-data'; export default DS.JSONSerializer.extend({ serializeBelongsTo: function(snapshot, json, relationship) { var key = relationship.key; var belongsTo = snapshot.belongsTo(key); key = this.keyForRelationship ? this.keyForRelationship(key, "be

DS.JSONSerializer#serializeAttribute()

serializeAttribute (snapshot, json, key, attribute) Defined in addon/serializers/json.js:1106 serializeAttribute can be used to customize how DS.attr properties are serialized For example if you wanted to ensure all your attributes were always serialized as properties on an attributes object you could write: app/serializers/application.js import DS from 'ember-data'; export default DS.JSONSerializer.extend({ serializeAttribute: function(snapshot, json, key, attributes) { json.attrib

DS.JSONSerializer#serialize()

serialize (snapshot, options) Object Inherited from DS.Serializer but overwritten in addon/serializers/json.js:898 Called when a record is saved in order to convert the record into JSON. By default, it creates a JSON object with a key for each attribute and belongsTo relationship. For example, consider this model: app/models/comment.js import DS from 'ember-data'; export default DS.Model.extend({ title: DS.attr(), body: DS.attr(), author: DS.belongsTo('user') }); The default serial

DS.JSONSerializer#primaryKey

primaryKey{String} Defined in addon/serializers/json.js:87 The primaryKey is used when serializing and deserializing data. Ember Data always uses the id property to store the id of the record. The external source may not always follow this convention. In these cases it is useful to override the primaryKey property to match the primaryKey of your external store. Example app/serializers/application.js import DS from 'ember-data'; export default DS.JSONSerializer.extend({ primaryKey: '_id'

DS.JSONSerializer#normalizeUsingDeclaredMapping()

normalizeUsingDeclaredMappingprivate Defined in addon/serializers/json.js:765

DS.JSONSerializer#normalizeUpdateRecordResponse()

normalizeUpdateRecordResponse (store, primaryModelClass, payload, id, requestType) Object Defined in addon/serializers/json.js:388 Available since 1.13.0 Parameters: store DS.Store primaryModelClass DS.Model payload Object id String|Number requestType String Returns: Object JSON-API Document

DS.JSONSerializer#normalizeSingleResponse()

normalizeSingleResponse (store, primaryModelClass, payload, id, requestType) Object Defined in addon/serializers/json.js:416 Available since 1.13.0 Parameters: store DS.Store primaryModelClass DS.Model payload Object id String|Number requestType String Returns: Object JSON-API Document

DS.JSONSerializer#normalizeSaveResponse()

normalizeSaveResponse (store, primaryModelClass, payload, id, requestType) Object Defined in addon/serializers/json.js:402 Available since 1.13.0 Parameters: store DS.Store primaryModelClass DS.Model payload Object id String|Number requestType String Returns: Object JSON-API Document

DS.JSONSerializer#normalizeResponse()

normalizeResponse (store, primaryModelClass, payload, id, requestType) Object Inherited from DS.Serializer but overwritten in addon/serializers/json.js:202 Available since 1.13.0 The normalizeResponse method is used to normalize a payload from the server to a JSON-API Document. http://jsonapi.org/format/#document-structure This method delegates to a more specific normalize method based on the requestType. To override this method with a custom one, make sure to call return this._super(store,