Freigeben über


2.2.6.3.2 Entity Set (as a Verbose JSON Array)

An EntitySet or collection of entities MUST be represented as an array of Verbose JSON objects, with one object for each EntityType instance within the set. A Verbose JSON-based format for EntityTypes is defined in Entity Type (as a Verbose JSON object) (section 2.2.6.3.3).

An empty EntitySet or collection of entities (one that contains no EntityType instances) MUST be represented as an empty JSON array.

The syntax of the Verbose JSON representation of a collection of entities is defined by the grammar listed in this section. The grammar rule "entitySetInVJson" defines the Verbose JSON representation of a collection of entities that can be used in all versions of a request payload and OData 1.0 response payloads. The grammar rule "entitySetInVJson2" defines the OData 2.0 and OData 3.0 Verbose JSON representations of a collection of entities for response payloads only.

 ; Request and OData 1.0 response Verbose JSON representation of a collection of entities:
 entitySetInVJson =  begin-array
                   [entityTypeInVJson *(value-seperator entityTypeInVJson)]
                    end-array
  
 ; OData 2.0 and OData 3.0 response Verbose JSON representation of a collection of entities:
 entitySetInVJson2 = begin-object
                    [countNVP value-seperator] 
                    resultsNVP
                    [value-seperator nextLinkNVP]
                    end-object
                   
  
 resultsNVP      = quotation-mark "results" quotation-mark
                   name-seperator
                   begin-array
                   [entityTypeInVJson *(value-seperator entityTypeInVJson)]
                   end-array
  
 ; see section 2.2.6.3.2.1 for additional details
 countNVP        = quotation-mark "__count" quotation-mark
                   name-seperator
                   <count value as defined in section 2.2.6.3.2.1>
  
 nextLinkNVP     = quotation-mark "__next" quotation-mark
                   name-seperator
                   quotation-mark 
                   resourcePath "?" [skiptokenQueryOp]
                   quotation-mark
  
 entityTypeInVJson = ; see section 2.2.6.3.3
 resourcePath      = ; see section 2.2.3.1
 sysQueryOption    = ; see section 2.2.3.1

Listing: Entity Set Verbose JSON Representation

In response payloads representing a collection of entities, if the server does not include an "entityTypeInVJson" name/value pair (see section 2.2.6.3.3) for every entity in the collection of entities identified by the associated URI, then the JSON array represents a partial collection of entities. In this case, a "nextLinkNVP" name/value pair MUST be included in the JSON array to indicate it represents a partial collection. The URI in the associated "nextLinkNVP" name/value pair MUST have a value equal to the URI, which identifies the next partial set of entities from the originally identified complete set. Such a URI SHOULD include a Skip Token system query option (section 2.2.3.6.1.9) to indicate that the URI addresses the subsequent partial set of entities.

Note   The inclusion of a "nextLinkNVP" name/value pair in a Verbose JSON representation of a collection of entities has protocol versioning implications as described in Executing a Received RetrieveValue Request (section 3.2.5.4.2).