© The Author(s), under exclusive license to APress Media, LLC , part of Springer Nature 2021
D. TangPro Ember Datahttps://doi.org/10.1007/978-1-4842-6561-1_8

8. Working with Nested Data and Embedded Records

David Tang1  
(1)
Playa Vista, CA, USA
 

In this chapter, we’ll look at two ways of handling nested data in API payloads. The first approach involves defining a model attribute without a transform. The second approach makes uses of embedded records. Let's dive in!

Declaring Attributes Without Transforms

Let’s say we have the following JSON for a contact resource with address being a nested object:
{
  "id": 1,
  "name": "Richard Hendrix",
  "address": {
    "street": "123 Main St.",
    "zip": "90003"
  }
}
In Chapter 1 – Ember Data Overview, we learned about ...

Get Pro Ember Data: Getting Ember Data to Work with Your API now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.