A serializer in Ember Data is used to massage data as it is transferred between the client and the persistence layer. This includes manipulating attribute values, normalizing property names, serializing relationships, and adjusting the structure of request payloads and responses. Ember Data comes with a few serializers:
Updated on 8/12/2016: For those who want to start learning Ember 2, here is a list of my recommendations for the best places to learn Ember.
Ember Data has a feature called transforms that allow you to transform values before they are set on a model or sent back to the server. A transform has two functions:
deserialize. Deserialization converts a value to a format that the client expects. Serialization does the reverse and converts a value to the format expected by the backend. If you’ve been working with Ember Data, then you have already been using transforms and may not have known it. The built in transforms include:
Recently I was in a situation where I had a list of Ember Data records and I wanted to write a unit test for a computed property in my controller that returned the most recent record. My model hook called
query on the store for all