Ember data Post format


#1

My web api is expection something like {firstName: “”, lastName: “”} but the restadaptor formats posts like this:{client: {firstName: “”, lastName: “”}} how do i get the correct format?


#2

You likely need to override the serialize method in the RESTSerializer:

Look into RESTSerializer.serialize and RESTSerializer.serializeIntoHash to start. Also search Github for “Ember-Data” and there a ton of adapters you can reference if needed.


#3

@ultimatemonty is spot on IMHO regarding the need to override.

You might be interested to know why the RESTAdaptor formats the data with a ‘containing property’ of client (in your case): See http://jsonapi.org/ a project of Yehuda Katz, one of the EmberJS principals. That data architecture is proferred as a standard, so I guess EmberJS is walking the walk, as it were.