Information technology — Open data protocol (OData) v4.0 — Part 2: OData JSON Format

ISO/IEC 20802-2:2016 extends ISO/IEC 20802-1, the core specification of the Open Data Protocol (OData) for representing and interacting with structured content, by defining representations for Odata requests and responses using a JSON format.

Technologies de l'information — Protocole de données ouvertes (OData) v4.0 — Partie 2: Format OData JSON

General Information

Status
Published
Publication Date
14-Dec-2016
Current Stage
9093 - International Standard confirmed
Start Date
10-May-2025
Completion Date
30-Oct-2025
Ref Project
Standard
ISO/IEC 20802-2:2016 - Information technology — Open data protocol (OData) v4.0 — Part 2: OData JSON Format Released:12/15/2016
English language
43 pages
sale 15% off
Preview
sale 15% off
Preview

Standards Content (Sample)


INTERNATIONAL ISO/IEC
STANDARD 20802-2
First edition
2016-12-15
Information technology — Open data
protocol (OData) v4.0
Part 2:
OData JSON Format
Technologies de l'information — Protocole de données ouvertes
(OData) v4.0 —
Partie 2: Format OData JSON
Reference number
©
ISO/IEC 2016
©  ISO/IEC 2016
All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized otherwise in any form or by any
means, electronic or mechanical, including photocopying, or posting on the internet or an intranet, without prior written permission.
Permission can be requested from either ISO at the address below or ISO’s member body in the country of the requester.
ISO copyright office
Ch. de Blandonnet 8 • CP 401
CH-1214 Vernier, Geneva, Switzerland
Tel. +41 22 749 01 11
Fax +41 22 749 09 47
copyright@iso.org
www.iso.org
ii © ISO/IEC 2016 – All rights reserved

Foreword
ISO (the International Organization for Standardization) and IEC (the International Electrotechnical
Commission) form the specialized system for worldwide standardization. National bodies that are
members of ISO or IEC participate in the development of International Standards through technical
committees established by the respective organization to deal with particular fields of technical activity.
ISO and IEC technical committees collaborate in fields of mutual interest. Other international
organizations, governmental and non‐governmental, in liaison with ISO and IEC, also take part in the
work. In the field of information technology, ISO and IEC have established a joint technical committee,
ISO/IEC JTC 1.
The procedures used to develop this document and those intended for its further maintenance are
described in the ISO/IEC Directives, Part 1. In particular the different approval criteria needed for the
different types of document should be noted. This document was drafted in accordance with the
editorial rules of the ISO/IEC Directives, Part 2 (see www.iso.org/directives).
Attention is drawn to the possibility that some of the elements of this document may be the subject of
patent rights. ISO and IEC shall not be held responsible for identifying any or all such patent rights.
Details of any patent rights identified during the development of the document will be in the
Introduction and/or on the ISO list of patent declarations received (see www.iso.org/patents).
Any trade name used in this document is information given for the convenience of users and does not
constitute an endorsement.
For an explanation on the meaning of ISO specific terms and expressions related to conformity
assessment, as well as information about ISO's adherence to the WTO principles in the Technical
Barriers to Trade (TBT) see the following URL: www.iso.org/iso/foreword.html.
ISO/IEC 20802‐2 was prepared by OASIS and was adopted, under the PAS procedure, by Joint Technical
Committee ISO/IEC JTC 1, Information technology, in parallel with its approval by the national bodies of
ISO and IEC.
© ISO/IEC 2016 – All rights reserved iii

OData JSON Format Version 4.0 Plus
Errata 02
OASIS Standard incorporating Approved Errata 02
30 October 2014
Specification URIs
This version:
http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-
errata02-os-complete.doc (Authoritative)
http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-
errata02-os-complete.html
http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-
errata02-os-complete.pdf
Previous version:
http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata01/os/odata-json-format-v4.0-
errata01-os-complete.doc (Authoritative)
http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata01/os/odata-json-format-v4.0-
errata01-os-complete.html
http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata01/os/odata-json-format-v4.0-
errata01-os-complete.pdf
Latest version:
http://docs.oasis-open.org/odata/odata-json-format/v4.0/odata-json-format-v4.0.doc
(Authoritative)
http://docs.oasis-open.org/odata/odata-json-format/v4.0/odata-json-format-v4.0.html
http://docs.oasis-open.org/odata/odata-json-format/v4.0/odata-json-format-v4.0.pdf
Technical Committee:
OASIS Open Data Protocol (OData) TC
Chairs:
Ralf Handl (ralf.handl@sap.com), SAP AG
Ram Jeyaraman (Ram.Jeyaraman@microsoft.com), Microsoft
Editors:
Ralf Handl (ralf.handl@sap.com), SAP AG
Michael Pizzo (mikep@microsoft.com), Microsoft
Martin Zurmuehl (martin.zurmuehl@sap.com), SAP AG
Mark Biamonte (mark.biamonte@progress.com), Progress Software
Additional artifacts:
This prose specification is one component of a Work Product that also includes:
OData JSON Format Version 4.0 Errata 02. Edited by Ralf Handl, Michael Pizzo, and Martin
Zurmuehl. 30 October 2014. OASIS Approved Errata. http://docs.oasis-open.org/odata/odata-
json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os.html.
Change-marked (redlined) version. OData JSON Format Version 4.0 Plus Errata 02
(redlined). Edited by Ralf Handl, Michael Pizzo, Martin Zurmuehl, and Mark Biamonte. 30
October 2014. OASIS Standard incorporating Approved Errata 02. http://docs.oasis-
odata-json-format-v4.0-errata02-os-complete 30 October 2014
Standards Track Work Product Copyright © OASIS Open 2014. All Rights Reserved. Page 1 of 43
© ISO/IEC 2016 – All rights reserved

open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-
redlined.html.
Related work:
This specification is related to:
OData Version 4.0. OASIS Standard. Multi-part Work Product that includes:
o OData Version 4.0 Part 1: Protocol. http://docs.oasis-
open.org/odata/odata/v4.0/os/part1-protocol/odata-v4.0-os-part1-protocol.html.
o OData Version 4.0 Part 2: URL Conventions. http://docs.oasis-
open.org/odata/odata/v4.0/os/part2-url-conventions/odata-v4.0-os-part2-url-
conventions.html.
o OData Version 4.0 Part 3: Common Schema Definition Language (CSDL).
http://docs.oasis-open.org/odata/odata/v4.0/os/part3-csdl/odata-v4.0-os-part3-
csdl.html.
o ABNF components: http://docs.oasis-open.org/odata/odata/v4.0/os/abnf/
o Vocabulary components: http://docs.oasis-
open.org/odata/odata/v4.0/os/vocabularies/
o XML schemas: http://docs.oasis-open.org/odata/odata/v4.0/os/schemas/
o OData Metadata Service Entity Model: http://docs.oasis-
open.org/odata/odata/v4.0/os/models/MetadataService.edmx.
OData Atom Format Version 4.0. Edited by Martin Zurmuehl, Michael Pizzo, and Ralf Handl.
Latest version: http://docs.oasis-open.org/odata/odata-atom-format/v4.0/odata-atom-format-
v4.0.html.
Abstract:
The Open Data Protocol (OData) for representing and interacting with structured content is
comprised of a set of specifications. The core specification for the protocol is in OData Version
4.0 Part 1: Protocol; this document extends the former by defining representations for OData
requests and responses using a JSON format.
Status:
This document was last revised or approved by the OASIS Open Data Protocol (OData) TC on
the above date. The level of approval is also listed above. Check the “Latest version” location
noted above for possible later revisions of this document. Any other numbered Versions and
other technical work produced by the Technical Committee (TC) are listed at https://www.oasis-
open.org/committees/tc_home.php?wg_abbrev=odata#technical.
TC members should send comments on this specification to the TC’s email list. Others should
send comments to the TC’s public comment list, after subscribing to it by following the
instructions at the “Send A Comment” button on the TC’s web page at https://www.oasis-
open.org/committees/odata/.
For information on whether any patents have been disclosed that may be essential to
implementing this specification, and any offers of patent licensing terms, please refer to the
Intellectual Property Rights section of the Technical Committee web page (https://www.oasis-
open.org/committees/odata/ipr.php).
Citation format:
When referencing this specification the following citation format should be used:
[OData-JSON-Format-v4.0-plus-Errata02]
OData JSON Format Version 4.0 Plus Errata 02. Edited by Ralf Handl, Michael Pizzo, Martin
Zurmuehl, and Mark Biamonte. 30 October 2014. OASIS Standard incorporating Approved Errata
02. http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-
errata02-os-complete.html. Latest version: http://docs.oasis-open.org/odata/odata-json-
format/v4.0/odata-json-format-v4.0.html.
odata-json-format-v4.0-errata02-os-complete 30 October 2014
Standards Track Work Product Copyright © OASIS Open 2014. All Rights Reserved. Page 2 of 43
© ISO/IEC 2016 – All rights reserved

Notices
Copyright © OASIS Open 2014. All Rights Reserved.
All capitalized terms in the following text have the meanings assigned to them in the OASIS Intellectual
Property Rights Policy (the "OASIS IPR Policy"). The full Policy may be found at the OASIS website.
This document and translations of it may be copied and furnished to others, and derivative works that
comment on or otherwise explain it or assist in its implementation may be prepared, copied, published,
and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice
and this section are included on all such copies and derivative works. However, this document itself may
not be modified in any way, including by removing the copyright notice or references to OASIS, except as
needed for the purpose of developing any document or deliverable produced by an OASIS Technical
Committee (in which case the rules applicable to copyrights, as set forth in the OASIS IPR Policy, must
be followed) or as required to translate it into languages other than English.
The limited permissions granted above are perpetual and will not be revoked by OASIS or its successors
or assigns.
This document and the information contained herein is provided on an "AS IS" basis and OASIS
DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY
WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY
OWNERSHIP RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
PARTICULAR PURPOSE.
OASIS requests that any OASIS Party or any other party that believes it has patent claims that would
necessarily be infringed by implementations of this OASIS Committee Specification or OASIS Standard,
to notify OASIS TC Administrator and provide an indication of its willingness to grant patent licenses to
such patent claims in a manner consistent with the IPR Mode of the OASIS Technical Committee that
produced this specification.
OASIS invites any party to contact the OASIS TC Administrator if it is aware of a claim of ownership of
any patent claims that would necessarily be infringed by implementations of this specification by a patent
holder that is not willing to provide a license to such patent claims in a manner consistent with the IPR
Mode of the OASIS Technical Committee that produced this specification. OASIS may include such
claims on its website, but disclaims any obligation to do so.
OASIS takes no position regarding the validity or scope of any intellectual property or other rights that
might be claimed to pertain to the implementation or use of the technology described in this document or
the extent to which any license under such rights might or might not be available; neither does it
represent that it has made any effort to identify any such rights. Information on OASIS' procedures with
respect to rights in any document or deliverable produced by an OASIS Technical Committee can be
found on the OASIS website. Copies of claims of rights made available for publication and any
assurances of licenses to be made available, or the result of an attempt made to obtain a general license
or permission for the use of such proprietary rights by implementers or users of this OASIS Committee
Specification or OASIS Standard, can be obtained from the OASIS TC Administrator. OASIS makes no
representation that any information or list of intellectual property rights will at any time be complete, or
that any claims in such list are, in fact, Essential Claims.
The name "OASIS" is a trademark of OASIS, the owner and developer of this specification, and should be
used only to refer to the organization and its official outputs. OASIS welcomes reference to, and
implementation and use of, specifications, while reserving the right to enforce its marks against
misleading uses. Please see https://www.oasis-open.org/policies-guidelines/trademark for above
guidance.
odata-json-format-v4.0-errata02-os-complete 30 October 2014
Standards Track Work Product Copyright © OASIS Open 2014. All Rights Reserved. Page 3 of 43
© ISO/IEC 2016 – All rights reserved

Table of Contents
1 Introduction . 6
1.1 Terminology . 6
1.2 Normative References . 6
1.3 Typographical Conventions . 7
2 JSON Format Design . 8
3 Requesting the JSON Format . 9
3.1 Controlling the Amount of Control Information in Responses . 9
3.1.1 odata.metadata=minimal . 9
3.1.2 odata.metadata=full . 10
3.1.3 odata.metadata=none . 10
3.2 Controlling the Representation of Numbers . 10
4 Common Characteristics . 11
4.1 Header Content-Type . 11
4.2 Message Body . 11
4.3 Relative URLs . 11
4.4 Payload Ordering Constraints. 12
4.5 Control Information . 12
4.5.1 Annotation odata.context . 13
4.5.2 Annotation odata.metadataEtag . 13
4.5.3 Annotation odata.type . 13
4.5.4 Annotation odata.count . 14
4.5.5 Annotation odata.nextLink . 14
4.5.6 Annotation odata.deltaLink . 14
4.5.7 Annotation odata.id . 14
4.5.8 Annotation odata.editLink and odata.readLink . 15
4.5.9 Annotation odata.etag . 15
4.5.10 Annotation odata.navigationLink and odata.associationLink . 16
4.5.11 Annotation odata.media* . 16
5 Service Document . 17
6 Entity . 19
7 Structural Property. 20
7.1 Primitive Value . 20
7.2 Complex Value . 21
7.3 Collection of Primitive Values . 21
7.4 Collection of Complex Values . 21
8 Navigation Property . 23
8.1 Navigation Link . 23
8.2 Association Link . 23
8.3 Expanded Navigation Property . 23
8.4 Deep Insert . 24
8.5 Bind Operation . 24
9 Stream Property . 25
odata-json-format-v4.0-errata02-os-complete 30 October 2014
Standards Track Work Product Copyright © OASIS Open 2014. All Rights Reserved. Page 4 of 43
© ISO/IEC 2016 – All rights reserved

10 Media Entity . 26
11 Individual Property or Operation Response . 27
12 Collection of Entities . 28
13 Entity Reference . 29
14 Delta Response . 30
14.1 Added/Changed Entity . 31
14.2 Deleted Entity . 31
14.3 Added Link . 31
14.4 Deleted Link . 32
15 Bound Function . 33
16 Bound Action . 34
17 Action Invocation . 35
18 Instance Annotations . 36
18.1 Annotate a JSON Object . 36
18.2 Annotate a JSON Array or Primitive . 36
19 Error Response . 37
20 Extensibility . 38
21 Security Considerations . 39
22 Conformance . 40
Appendix A. Acknowledgments . 41
Appendix B. Revision History . 42

odata-json-format-v4.0-errata02-os-complete 30 October 2014
Standards Track Work Product Copyright © OASIS Open 2014. All Rights Reserved. Page 5 of 43
© ISO/IEC 2016 – All rights reserved

1 Introduction
The OData protocol is comprised of a set of specifications for representing and interacting with structured
content. The core specification for the protocol is in [OData-Protocol]; this document is an extension of
the core protocol. This document defines representations for the OData requests and responses using
the JavaScript Object Notation (JSON), see [RFC7159].
An OData JSON payload may represent:
a single primitive value
a collection of primitive values
a single complex type value
a collection of complex type values
a single entity or entity reference
a collection of entities or entity references
a collection of changes
a service document describing the top-level resources exposed by the service
an error.
1.1 Terminology
The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD
NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described
in [RFC2119].
1.2 Normative References
[GeoJSON] Howard Butler, Martin Daly, Alan Doyle, Sean Gillies, Tim Schaub and Stefan
Drees, "The GeoJSON Format" draft-butler-geojson-02, 15 March 2014.
http://tools.ietf.org/html/draft-butler-geojson-02.
[I-JSON] Bray, T., Ed., "The I-JSON Message Format" draft-bray-i-json-01, 06 January
2014. http://tools.ietf.org/html/draft-bray-i-json-01
[OData-ABNF] OData ABNF Construction Rules Version 4.0.
See link in “Related work” section on cover page.
[OData-CSDL] OData Version 4.0 Part 3: Common Schema Definition Language (CSDL).
See link in “Related work” section on cover page.
[OData-Protocol] OData Version 4.0 Part 1: Protocol.
See link in “Related work” section on cover page.
[OData-URL] OData Version 4.0 Part 2: URL Conventions.
See link in "Related work" section on cover page.
[OData-VocCap] OData Capabilities Vocabulary.
See link in "Related work" section on cover page.
[RFC2119] Bradner, S., “Key words for use in RFCs to Indicate Requirement Levels”, BCP
14, RFC 2119, March 1997. http://www.ietf.org/rfc/rfc2119.txt.
[RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, “Uniform Resource Identifier (URI):
Generic Syntax”, IETF RFC3986, January 2005.
http://www.ietf.org/rfc/rfc3986.txt.
[RFC3987] Duerst, M. and, M. Suignard, “Internationalized Resource Identifiers (IRIs)”, RFC
3987, January 2005. http://www.ietf.org/rfc/rfc3987.txt.
[RFC7159] Bray, T., Ed., “The JavaScript Object Notation (JSON) Data Interchange Format”,
RFC 7159, March 2014. http://tools.ietf.org/html/rfc7159.
odata-json-format-v4.0-errata02-os-complete 30 October 2014
Standards Track Work Product Copyright © OASIS Open 2014. All Rights Reserved. Page 6 of 43
© ISO/IEC 2016 – All rights reserved

[RFC5646] Phillips, A., Ed., and M. Davis, Ed., “Tags for Identifying Languages”, BCP 47,
RFC 5646, September 2009. http://tools.ietf.org/html/rfc5646.
[ECMAScript] ECMAScript Language Specification Edition 5,1. June 2011. Standard ECMA-
262. http://www.ecma-international.org/publications/standards/Ecma-262.htm.
1.3 Typographical Conventions
Keywords defined by this specification use this monospaced font.
Normative source code uses this paragraph style.
Some sections of this specification are illustrated with non-normative examples.
Example 1: text describing an example uses this paragraph style
Non-normative examples use this paragraph style.
All examples in this document are non-normative and informative only.
All other text is normative unless otherwise labeled.
odata-json-format-v4.0-errata02-os-complete 30 October 2014
Standards Track Work Product Copyright © OASIS Open 2014. All Rights Reserved. Page 7 of 43
© ISO/IEC 2016 – All rights reserved

2 JSON Format Design
JSON, as described in [RFC7159], defines a text format for serializing structured data. Objects are
serialized as an unordered collection of name-value pairs.
JSON does not define any semantics around the name/value pairs that make up an object, nor does it
define an extensibility mechanism for adding control information to a payload.
OData’s JSON format extends JSON by defining general conventions for name-value pairs that annotate
a JSON object, property or array. OData defines a set of canonical annotations for control information
such as ids, types, and links, and custom annotations MAY be used to add domain-specific information to
the payload.
A key feature of OData’s JSON format is to allow omitting predictable parts of the wire format from the
actual payload. To reconstitute this data on the receiving end, expressions are used to compute missing
links, type information, and other control data. These expressions (together with the data on the wire) can
be used by the client to compute predictable payload pieces as if they had been included on the wire
directly.
Annotations are used in JSON to capture control information that cannot be predicted (e.g., the next link
of a collection) as well as a mechanism to provide values where a computed value would be wrong (e.g.,
if the media read link of one particular entity does not follow the standard URL conventions). Computing
values from metadata expressions is compute intensive and some clients might opt for a larger payload
size to avoid computational complexity; to accommodate for this the Accept header allows the client to
control the amount of control information added to the response.
To optimize streaming scenarios, there are a few restrictions that MAY be imposed on the sequence in
which name/value pairs appear within JSON objects. For details on the ordering requirements see
Payload Ordering Constraints.
odata-json-format-v4.0-errata02-os-complete 30 October 2014
Standards Track Work Product Copyright © OASIS Open 2014. All Rights Reserved. Page 8 of 43
© ISO/IEC 2016 – All rights reserved

3 Requesting the JSON Format
The OData JSON format can be requested using the $format query option in the request URL with the
MIME type application/json, optionally followed by format parameters, or the case-insensitive
abbreviation json which MUST NOT be followed by format parameters.
Alternatively, this format can be requested using the Accept header with the MIME type
application/json, optionally followed by format parameters.
If specified, $format overrides any value specified in the Accept header.
Possible format parameters are:
odata.metadata
IEEE754Compatible
odata.streaming
Services SHOULD advertise the supported MIME types by annotating the entity container with the term
Capabilities.SupportedFormats defined in [OData-VocCap], listing all available formats and
combinations of supported format parameters.
3.1 Controlling the Amount of Control Information in Responses
The amount of control information needed (or desired) in the payload depends on the client application
and device. The odata.metadata parameter can be applied to the Accept header of an OData request
to influence how much control information will be included in the response.
Other Accept header parameters (e.g., odata.streaming) are orthogonal to the odata.metadata
parameter and are therefore not mentioned in this section.
If a client prefers a very small wire size and is intelligent enough to compute data using metadata
expressions, the Accept header should include odata.metadata=minimal. If computation is more
critical than wire size or the client is incapable of computing control information, odata.metadata=full
directs the service to inline the control information that normally would be computed from metadata
expressions in the payload. odata.metadata=none is an option for clients that have out-of-band
knowledge or don't require control information.
3.1.1 odata.metadata=minimal
The odata.metadata=minimal format parameter indicates that the service SHOULD remove
computable control information from the payload wherever possible. This is the default value for the
odata.metadata parameter and will be assumed if no other value is specified in the Accept header or
$format query option. The response payload MUST contain at least the following common annotations:
odata.context: the root context URL of the payload and the context URL for any deleted
entries or added or deleted links in a delta response, or for entities or entity collections whose set
cannot be determined from the root context URL
odata.metadataEtag: the ETag of the metadata document as applicable
odata.etag: the ETag of the entity, as appropriate
odata.count: the total count of a collection of entities or collection of entity references, if
requested
odata.nextLink: the next link of a collection with partial results
odata.deltaLink: the delta link for obtaining changes to the result, if requested
In addition, odata annotations MUST appear in the payload for cases where actual values are not the
same as the computed values and MAY appear otherwise. When odata annotations appear in the
payload, they are treated as exceptions to the computed values.
odata-json-format-v4.0-errata02-os-complete 30 October 2014
Standards Track Work Product Copyright © OASIS Open 2014. All Rights Reserved. Page 9 of 43
© ISO/IEC 2016 – All rights reserved

Media entities and stream properties MAY in addition contain the following annotations:
odata.mediaEtag: the ETag of the stream, as appropriate
odata.mediaContentType: the content type of the stream
3.1.2 odata.metadata=full
The odata.metadata=full format parameter indicates that the service MUST include all control
information explicitly in the payload.
The full list of annotations that may appear in an odata.metadata=full response is as follows:
odata.context: the context URL for a collection, entity, primitive value, or service document.
odata.count: the total count of a collection of entities or collection of entity references, if
requested.
odata.nextLink: the next link of a collection with partial results
odata.deltaLink: the delta link for obtaining changes to the result, if requested
odata.id: the ID of the entity
odata.etag: the ETag of the entity
odata.readLink: the link used to read the entity, if the edit link cannot be used to read the
entity
odata.editLink: the link used to edit/update the entity, if the entity is updatable and the
odata.id does not represent a URL that can be used to edit the entity
odata.navigationLink: the link used to retrieve the values of a navigation property
odata.associationLink: the link used to describe the relationship between this entity and
related entities
odata.type: the type of the containing object or targeted property if the type of the object or
targeted property cannot be heuristically determined
Media entities and stream properties may in addition contain the following annotations:
odata.mediaReadLink: the link used to read the stream
odata.mediaEditLink: the link used to edit/update the stream
odata.mediaEtag: the ETag of the stream, as appropriate
odata.mediaContentType: the content type of the stream
3.1.3 odata.metadata=none
The odata.metadata=none format parameter indicates that the service SHOULD omit control
information other than odata.nextLink and odata.count. These annotations MUST continue to be
included, as applicable, even in the odata.metadata=none case.
It is not valid to specify odata.metadata=none on a delta request.
3.2 Controlling the Representation of Numbers
The IEEE754Compatible=true format parameter indicates that the service MUST serialize
Edm.Int64 and Edm.Decimal numbers (including the odata.count, if requested) as strings. This is in
conformance with [I-JSON].
If not specified, or specified as IEEE754Compatible=false, all numbers MUST be serialized as JSON
numbers.
This enables support for JavaScript numbers that are defined to be 64-bit binary format IEEE 754 values
[ECMAScript] (see section 4.3.1.9) resulting in integers losing precision past 15 digits, and decimals
losing precision due to the conversion from base 10 to base 2.
OData JSON payloads that format Edm.Int64 and Edm.Decimal values as strings MUST specify this
format parameter in the media type returned in the Content-Type header.
odata-json-format-v4.0-errata02-os-complete 30 October 2014
Standards Track Work Product Copyright © OASIS Open 2014. All Rights Reserved. Page 10 of 43
© ISO/IEC 2016 – All rights reserved

4 Common Characteristics
This section describes common characteristics of the representation for OData values in JSON. A request
or response body consists of several parts. It contains OData values as part of a larger document.
Requests and responses are structured almost identical; the few existing differences will be explicitly
called out in the respective subsections.
4.1 Header Content-Type
Requests and responses with a JSON message body MUST have a Content-Type header value of
application/json.
Requests MAY add the charset parameter to the content type. Allowed values are UTF-8, UTF-16,
and UTF-32. If no charset parameter is present, UTF-8 MUST be assumed.
Responses MUST include the odata.metadata parameter to specify the amount of metadata included
in the response.
Responses MUST include the IEEE754Compatible parameter if Edm.Int64 and Edm.Decimal
numbers are represented as strings.
Requests and responses MAY add the odata.streaming parameter with a value of true or false,
see section Payload Ordering Constraints.
4.2 Message Body
Each message body is represented as a single JSON object. This object is either the representation of an
entity, an entity reference or a complex type instance, or it contains a name/value pair whose name
MUST be value and whose value is the correct representation for a primitive value, a collection of
primitive values, a collection of complex values, a collection of entities, or a collection of objects that
represent changes to a previous result.
Client libraries MUST retain the order of objects within an array in JSON responses.
4.3 Relative URLs
URLs present in a payload (whether request or response) MAY be represented as relative URLs.
Relative URLs, other than those in odata.type, are relative to their base URL, which is
the context URL of the same JSON object, if one exists, otherwise
the context URL of the enclosing object, if one exists, otherwise
the context URL of the next enclosing object, if one exists, etc. until the document root, otherwise
the request URL.
For context URLs these rules apply starting with the second bullet point.
Within the odata.type annotation, relative URLs are relative to the base type URL, which is
the odata.type of the enclosing object, if one exists, otherwise
the odata.type of the next enclosing object, if one exists, etc. until the document root,
otherwise
the context URL of the document root, if one exists, otherwise
the request URL.
Processors expanding the URLs MUST use normal URL expansion rules as defined in RFC3986. This
means that if the base URL is a context URL, the part starting with $metadata# is ignored when
resolving the relative URL.
odata-json-format-v4.0-errata02-os-complete 30 October 2014
Standards Track Work Product Copyright © OASIS Open 2014. All Rights Reserved. Page 11 of 43
© ISO/IEC 2016 – All rights reserved

Clients that receive relative URLs in response payloads SHOULD use the same relative URLs, where
appropriate, in request payloads (such as bind operations and batch requests) and in system query
options (such as $id).
Example 2:
{
"@odata.context": "http://host/service/$metadata#Customers/$entity",
...
"@odata.editLink": "Customers('ALFKI')",
...
"Orders@odata.navigationLink": "Customers('ALFKI')/Orders",
...
}
The resulting absolute URLs are http://host/service/Customers('ALFKI') and
http://host/service/Customers('ALFKI')/Orders.
4.4 Payload Ordering Constraints
Ordering constraints MAY be imposed on the JSON payload in order to support streaming scenarios.
These ordering constraints MUST only be assumed if explicitly specified as some clients (and services)
might not be able to control, or might not care about, the order of the JSON properties in the payload.
Clients can request that a JSON response conform to these ordering constraints by specifying a media
type of application/json with the odata.streaming=true parameter in the Accept header or
$format query option. Services MUST return 406 Not Acceptable if the client only requests
streaming and the service does not support it.
Processors MUST only assume streaming support if it is explicitly indicated in the Content-Type header
via the odata.streaming=true parameter.
Example 3: a payload with
Content-Type: application/json;odata.metadata=minimal;odata.streaming=true
can be assumed to support streaming, whereas a payload with
Content-Type: application/json;odata.metadata=minimal
cannot be assumed to support streaming.
JSON producers are encouraged to follow the payload ordering constraints whenever possible (and
include the odata.streaming=true content type parameter) to support the maximum set of client
scenarios.
To support streaming scenarios the following payload ordering constraints have to be met:
If present, the odata.context annotation MUST be the first property in the JSON object.
The odata.type annotation, if present, MUST appear next in the JSON object.
The odata.id and odata.etag annotations MUST appear before any property or property
annotation.
All annotations for a structural or navigation property MUST appear as a group immediately
before the property they annotate. The one exception is the odata.nextLink annotation of an
expanded collection which MAY appear after the navigation property it annotates.
All other odata annotations can appear anywhere in the payload as long as they do not violate
any of the above rules.
Annotations for navigation properties MUST appear after all structural properties.
4.5 Control Information
In addition to the “pure data” a message body MAY contain control information that is represented as
annotations whose names start with odata followed by a dot.
odata-json-format-v4.0-errata02-os-complete 30 October 2014
Standards Track Work Product Copyright © OASIS Open 2014. All Rights Reserved. Page 12 of 43
© ISO/IEC 2016 – All rights reserved

In some cases control information is required in request payloads; this is called out in the following
subsections.
Receivers that encounter unknown annotations in any namespace, including the odata namespace,
MUST NOT stop processing and MUST NOT signal an error.
4.5.1 Annotation odata.context
The odata.context annotation returns the context URL (see [OData-Protocol]) for the payload. This
URL can be absolute or relative.
The odata.context annotation is not returned if odata.metadata=none is requested. Otherwise it
MUST be the first property of any JSON response.
The odata.context annotation MUST also be included in requests and responses for entities whose
entity set cannot be determined from the context URL of the collection.
For more information on the format of the context URL, see [OData-Protocol].
Request payloads MAY include a context URL as a base URL for relative URLs in the request payload.
Example 4:
{
"@odata.context": "http://host/service/$metadata#Customers/$entity",
"@odata.metadataEtag": "W/\"A1FF3E230954908F\"",
...
}
4.5.2 Annotation odata.metadataEtag
The odata.metadataEtag annotation MAY appear in a response in order to specify the entity tag
(ETag) that can be used to determine the version of the metadata of the response.
For details on how ETags are used, see [OData-Protocol].
4.5.3 Annotation odata.type
The odata.type annotation specifies the type of a JSON object or name/value pair. Its value is a URI
that identifies the type of the property or object. For built-in primitive types the value is the unqualified
name of the primitive type, specified as a URI fragment. For all other types, the URI may be absolute or
relative to the odata.type of the containing object. The root odata.type may be absolute or relative to
the root context URL.
For non-built in primitive types, the URI contains the namespace-qualified or alias-qualified type, specified
as a URI fragment. For properties that represent a collection of values, the fragment is the namespace-
qualified or alias-qualified element type enclosed in parentheses and prefixed with Collection.
The odata.type annotation MUST appear in requests and in responses with minimal or full metadata, if
the type cannot be heuristically determined, as described below, and one of the following is true:
The type is derived from the type specified for the (collection of) entities or (collection of) complex
type instances, or
The type is for a property whose type is not declared in $metadata.
The following heuristics are used to determine the primitive type of a dynamic property in the absence of
the odata.type annotation:
Boolean values have a first-class repr
...

Questions, Comments and Discussion

Ask us and Technical Secretary will try to provide an answer. You can facilitate discussion about the standard in here.

Loading comments...