# Custom Serializer for non-Ember style API?

**URL:** <https://discuss.emberjs.com/t/custom-serializer-for-non-ember-style-api/6077>\
**Category:** Ember Data\
**Created:** [August 14, 2014, 4:57pm UTC](https://discuss.emberjs.com/t/custom-serializer-for-non-ember-style-api/6077 "2014-08-14T16:57:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Grapho](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/grapho/32/9371_2.png) [@Grapho](https://discuss.emberjs.com/u/Grapho)\
**Post date:** [August 14, 2014, 4:57pm UTC](https://discuss.emberjs.com/t/custom-serializer-for-non-ember-style-api/6077/1 "2014-08-14T16:57:15Z")

</div>

Assuming that my JSON Payload looks something like this:

```
{
  "status": "string",
  "data": {
    "debtor": {
      "debtor_id": "integer",
      "debtor_contact_id": "integer",
      "debtor_type": "string",
      "debtor_balance": "float",
      "debtor_next_contact_date": "dateTime",
      "debtor_tax_id": "string",
      "debtor_timezone": "string",
      "debtor_full_name": "string",
      "debtor_first_name": "string",
      "debtor_last_name": "string",
      "debtor_middle_initial": "string",
      "debtor_salutation": "string",
      "debtor_email": "string"
    }
  },
  "message": "string",
  "code": "string"
}

```

How can I write a serializer/de-serializer that can format a record the way Ember-Data wants?

The data is two levels deep… and i know how to set a primaryKey to “debtor\_id”… but “data” is a root key, and “debtor” is i guess like a collection key… but i don’t know if Ember-Data has any built-in methods to address those keys?

**Edit:** this particular example is just a return of a single record, but could the same serializer be used on a collection? or would i need a custom one for that as well…?
