2.2.6.3.9.1 Inline Representation

As described in Expand System Query Option ($expand) (section 2.2.3.6.1.3), a request URI can include the $expand system query option to explicitly request the entity or entities represented by a NavigationProperty be serialized inline, rather than deferred. The example shown in this section uses the same data model as the Deferred Content example referenced in the preceding section. However, the following example shows the value of the Orders NavigationProperty serialized inline.

A NavigationProperty that is serialized inline MUST be represented as a name/value pair on the JSON object with the name equal to the NavigationProperty name. If the NavigationProperty identifies a single EntityType instance, the value MUST be a JSON object representation of that EntityType instance, as specified in Entity Type (as a JSON object) (section 2.2.6.3.3). If the NavigationProperty represents an EntitySet, the value MUST be as specified in Entity Set (as a JSON array) (section 2.2.6.3.2).

                    "etag": "W/\"X\'000000000000FA01\'""
 {
    "CustomerID": "ALFKI",
    "CompanyName": "Alfreds Futterkiste",
    "Address": { "Street": "57 Contoso St", "City": "Seattle",
      "Location": {
        "crs": {
          "type": "name",
          "properties": { "name": "EPSG:4326" }
        },
        "type": "Point", "coordinates": [-127.9324, 49.2345]
      }
    },
    "Version": "AAAAAAAA+gE=",
    "Orders":
        {
          Results: [
          {
             "__metadata": { "uri": "Orders(1)",
                             "type": "SampleModel.Order"
                           },
             "OrderID": 1,
             "ShippedDate": "\/Date(872467200000)\/",
             "Customer":   { "__deferred": { "uri": "Orders(1)/Customer"} },
             "OrderLines": { "__deferred": { "uri": "Orders(1)/OrderLines"} },
             "__metadata": { "uri": "Orders(1)",
                             "type": "SampleModel.Order",
                             "properties" : {
                                "Customer" : {
                                   "associationuri" : "Orders(1)/$links/Customer"
                                }, 
                                "OrderLines" : {
                                   "associationuri" : "Orders(1)/$links/OrderLines"
                                }  
                              }
                          }
  
  
          },
          {
             "OrderID": 2,
             "ShippedDate": "\/Date(875836800000)\/",
             "Customer":   { "__deferred": { "uri": "Orders(2)/Customer" } },
             "OrderLines": { "__deferred": { "uri": "Orders(2)/OrderLines" } },
             "__metadata": { "uri": "Orders(2)",
                             "type": "SampleModel.Order",
                             "properties" : {
                                "Customer" : {
                                   "associationuri" : "Orders(2)/$links/Customer"
                                }, 
                                "OrderLines" : {
                                   "associationuri" : "Orders(2)/$links/OrderLines"
                                }  
                              }
                          }
  
  
  
          }
    ] ,
    "__metadata": { "uri": "Customers(\'ALFKI\')",
                    "type": "SampleModel.Customer",
                    "etag": "W/\"X\'000000000000FA01\'\"",
                    "properties" : {
                          "Orders" : {
                                 "associationuri" : "Customers(\'ALFKI\')/$links/Orders"
                          }
                    } 
                  }
  
 }

Listing: OData Verbose 3.0 JSON-Formatted Customer Entity with the Orders Navigation Property Value Formatted Inline