DS.RESTSerializer, DS.RESTAdapter


#1

Hi there,

after successful tweaking my API response (adding model roots to the JSON) I am desperately seeking for a way to modify the POST payload from

modelName : { propertyOne : valueOne, propertyTwo : valueTwo }

to

{ propertyOne : valueOne, propertyTwo : valueTwo }

Any idea?

Thanks in advance, Martin


#2

How about overriding normalizeFindRecordResponse in your serializer?


#3

To my understanding this would modify the server’s response, right? I need to modify the request!


#4

Have you seen this?


#5

Damn! How could I not find this? Thank you, @michaelkirk!


#6

Oops! I read too fast :slight_smile:

Then, it’s not the normalize but the serialize method you should override.


#7

Was my first try, but it turned out that in

serialize: function(snapshot, options) {
    var json = this._super(snapshot, options);
}

the JSON was already “flat”! Still a lot to learn…

Regards, Martin