Discussions
Transform server response to match schema.
about 10 years ago by Arnaud Bosc
Hi Jason,
Is there a way to tell js-data to parse a resource response object differently ?
Let's say your server respond the following json :
{
"i": 123,
"n": "Alfred"
}
And you want your resource to be defined as follow :
DS.defineResource("person", {
schema: {
id: "string",
name: "string"
}
});
I know I can do it with a http request/response interceptor in AngularJS, but I would like to do it on the resource level.
Any idea ?