title: How to create a custom Serializer for Ember data
body: <p>I have an API that returns JSON that is not properly formatted for Ember's consumption.
  Instead of this (what ember is expecting):</p>
  
  <pre><code>{ events: [
      { id: 1, title: "Event 1", description: "Learn Ember" },
      { id: 2, title: "Event 2", description: "Learn Ember 2" }
  ]}
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>{ events: [
      { event: { id: 1, "Event 1", description: "Learn Ember" }},
      { event: { id: 2, "Event 2", description: "Learn Ember 2" }}
  ]}
  </code></pre>
  
  <p>So if I understood correctly, I need to create a custom Serializer to modify the JSON.</p>
  
  <pre><code>var store = DS.Store.create({
      adapter: DS.RESTAdapter.create({
          serializer: DS.Serializer.create({
              // which hook should I override??
          })
      })
  });
  </code></pre>
  
  <p>I've read the code comment related to the DS.Serializer, but I can't understand how to achieve what I want...</p>
  
  <p>How can I do it?</p>
  
  <p>ps: My goal is to make <code>App.Event.find()</code> work. Currently, I get <code>Uncaught Error: assertion failed: Your server returned a hash with the key 0 but you have no mapping for it</code>. That's why I need to fix the JSON received.</p>
  
  <p><strong>edit</strong>: Here's how I made it work, for now:</p>
  
  <pre><code>extractMany: function(loader, json, type, records) {
      var root = this.rootForType(type),
      roots = this.pluralize(root);
  
      json = reformatJSON(root, roots, json);
      this._super(loader, json, type, records);
    }
  </code></pre>