# Custom Serializer for "type"

**URL:** <https://discuss.emberjs.com/t/custom-serializer-for-type/18711>\
**Category:** Ember Data\
**Created:** [March 16, 2021, 6:29pm UTC](https://discuss.emberjs.com/t/custom-serializer-for-type/18711 "2021-03-16T18:29:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mroetheli](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/mroetheli/32/16972_2.png) [@mroetheli](https://discuss.emberjs.com/u/mroetheli)\
**Post date:** [March 16, 2021, 6:29pm UTC](https://discuss.emberjs.com/t/custom-serializer-for-type/18711/1 "2021-03-16T18:29:54Z")

</div>

Hi there

I’ve read the guide for custom serializers [Customizing Serializers - Ember Data - Ember Guides](https://guides.emberjs.com/release/models/customizing-serializers/) and I wanted to extend my application serializer with a specific format for the style info in the json-output:

```
import JSONAPISerializer from '@ember-data/serializer/json-api';
import { underscore } from '@ember/string';

export default JSONAPISerializer.extend({
	keyForAttribute(attr) {
		return underscore(attr);
	},
	keyForRelationship(key) {
		return underscore(key);
	}
});

```

I want to underscore the “type” info but there’s no keyForType or something similar.

```auto
{
  "data": {
    "type": "people", //<-----this type
    "id": "123",
    "attributes": {
      "given-name": "Jeff",
      "family-name": "Atwood"
    }
  }
}

```

Do I miss something or is this solved an other way.

Thank you

Michael

---

<div class="post-metadata">

**Author:** ![dknutsen](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/dknutsen/32/16471_2.png) [@dknutsen](https://discuss.emberjs.com/u/dknutsen)\
**Post date:** [March 16, 2021, 7:29pm UTC](https://discuss.emberjs.com/t/custom-serializer-for-type/18711/2 "2021-03-16T19:29:00Z")

</div>

It’s weirdly named but I think [modelNameFromPayloadKey](https://api.emberjs.com/ember-data/3.25/classes/JSONAPISerializer/methods/modelNameFromPayloadKey?anchor=modelNameFromPayloadKey) might be what you want?

---

<div class="post-metadata">

**Author:** ![mroetheli](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/mroetheli/32/16972_2.png) [@mroetheli](https://discuss.emberjs.com/u/mroetheli)\
**Post date:** [March 17, 2021, 6:59pm UTC](https://discuss.emberjs.com/t/custom-serializer-for-type/18711/3 "2021-03-17T18:59:38Z")

</div>

Thank you, I’ve found the correct one. In my case it was [JSONAPISerializer - 3.25 - Ember API Documentation](https://api.emberjs.com/ember-data/3.25/classes/JSONAPISerializer/methods/payloadKeyFromModelName?anchor=payloadKeyFromModelName).
