keyForAttribute (key, method) String
keyForAttribute
can be used to define rules for how to convert an attribute name in your model to a key in your JSON. By default JSONAPISerializer
follows the format used on the examples of http://jsonapi.org/format and uses dashes as the word separator in the JSON attribute keys.
This behaviour can be easily customized by extending this method.
Example
app/serializers/application.js
import DS from 'ember-data'; export default DS.JSONAPISerializer.extend({ keyForAttribute: function(attr, method) { return Ember.String.dasherize(attr).toUpperCase(); } });
Parameters:
-
key
String
-
method
String
Returns:
-
String
- normalized key
Please login to continue.