Skip to content
cmshawns edited this page Oct 7, 2014 · 4 revisions

Response JSON

Arrays are returned differently than single entities. In both cases the odata.metadata property is added, which provides a link describing the entity type(s). Arrays of entities are then returned embedded in a value property, while single object properties are left as-is at the root of the schema.

The following examples were taken from the demo oData V3 service:

Array of entities

Requesting .../OData.svc/Suppliers returns JSON in the following format:

{
	"odata.metadata": "http://.../$metadata#Suppliers",
	"value": [{
		"ID": 0,
		"Name": "Exotic Liquids",
		"Address": { ... },
	},
	{
		"ID": 1,
		"Name": "Tokyo Traders",
		"Address": { ... },
	}]
}

Single entity

Requesting .../OData.svc/Suppliers(1) returns JSON in the following format:

{
	"odata.metadata": "http://.../$metadata#Suppliers/@Element",
	"ID": 1,
	"Name": "Tokyo Traders",
	"Address": { ... },
}

References

Clone this wiki locally