diff --git a/index.html b/index.html index 2ed1a3ce..c4868d12 100644 --- a/index.html +++ b/index.html @@ -1,4 +1,4 @@ - +
-This section sets out the requirements for producing and consuming DID
-documents that are in plain JSON (as indicated by a
-contentType
of application/did+json
in the resolver
-metadata).
+This section defines the production and consumption rules
+for the JSON representation.
-A DID document MUST be a single JSON -object conforming to [[!RFC8259]]. All entries of the DID -document data model described in -MUST be represented by using the entry key as the name of the -member of the JSON object. The values of entries, -including all extensions, are encoded in JSON [[RFC8259]] by mapping entry -values to JSON types as follows: +The DID document and any DID document data structures expressed by the data model +MUST be serialized to the JSON representation according to the +following production rules:
-JSON Object, each entry is represented -as a member of the JSON Object with the entry key as the member name and the -entry value according to its type, as defined in this section +A JSON Object, where each entry is +serialized as a member of the JSON Object with the entry key as a JSON String member name and the entry value +according to its type, as defined in this table. | |
-JSON Array, each element of the list is -added, in order, as a value of the array according to its type, as defined in -this section +A JSON Array, where each element of the +list is serialized, in order, as a value of the array according to its type, as +defined in this table. | |
-JSON Array, each element of the set is -added, in order, as a value of the array according to its type, as defined in -this section +A JSON Array, where each element of the set +is added, in order, as a value of the array according to its type, as defined in +this table. | |
-JSON String formatted as an
+A JSON String serialized as an
XML Datetime normalized to
UTC 00:00:00 and without sub-second decimal precision. For example:
2020-12-20T19:17:47Z .
@@ -2648,7 +2641,7 @@ Productionstring |
-JSON String +A JSON String. |
-JSON Number without a decimal or -fractional component +A JSON Number without a decimal or +fractional component. | |
-JSON Number with a fractional component +A JSON Number with a decimal and +fractional component. | |
-JSON Boolean +A JSON Boolean. | |
-JSON null literal +A JSON null literal. |
-Implementers producing JSON are advised to ensure that their algorithms are -aligned with the JSON serialization rules in -the [[INFRA]] specification. +
+All implementers creating conforming producers that produce JSON +representations are advised to ensure that their algorithms are aligned +with the JSON serialization rules in the [[INFRA]] +specification and the +precision advisements regarding Numbers +in the JSON [[RFC7159]] specification.
-All entries of the DID document MUST be included in
-the root object. Entries MAY define additional data sub structures subject
-to the value representation rules in the list above.
+All entries of a DID document MUST be included in the root JSON Object. Entries MAY contain additional
+data substructures subject to the value representation rules in the list above.
+When serializing a DID document, a conforming producer MUST
+specify a media type of application/did+json
to downstream
+applications such as described in .
-The topmost element MUST be a JSON object. Any other data type at the topmost -level is an error and MUST be rejected. The topmost JSON object represents the -DID document, and all members of this object are entries of the DID -document. The object member name is the entry key, and the member value -is interpreted as follows: +The DID document and any DID document data structures expressed by a JSON representation MUST be +deserialized into the data model according to the +following consumption rules:
+ | JSON Representation Type |
@@ -2730,53 +2728,54 @@ ConsumptionJSON Object | -ordered map, each member of the JSON Object -is added as an entry to the ordered map with the entry key being the -member name and the value converted based on the JSON type and, if available, -entry definition, as defined here; as no order is specified by JSON Objects, -no insertion order is guaranteed +An ordered map, where each member of the JSON +Object is added as an entry to the ordered map. Each entry key is set as the +JSON Object member name. Each entry value is set by converting the JSON Object +member value according to the JSON representation type as defined in this table. +Since order is not specified by JSON Objects, no insertion order is guaranteed. |
---|---|---|---|
-JSON Array where data -model entry value is a list or unknown +JSON Array where the data model entry value is a list or unknown | -list, each value of the JSON Array is added to the -list in order, converted based on the JSON type of the array value, as defined -here +A list, where each value of the JSON Array is +added to the list in order, converted based on the JSON representation type of +the array value, as defined in this table. | ||
-JSON Array where data -model entry value is an JSON Array where the data model entry value is an ordered set | -ordered set, each value of the JSON -Array is added to the ordered set in order, converted based on the JSON type of -the array value, as defined here +An ordered set, where each value of +the JSON Array is added to the ordered set in order, converted based on the JSON +representation type of the array value, as defined in this table. | ||
JSON String where data model entry value is an datetime +href="#data-model">data model entry value is a datetime | -datetime +A datetime. | ||
-JSON String, where JSON String, where the data model entry value type is string or unknown | -string +A string. | ||
-integer +An integer. | |||
-JSON Number with a fractional component, or -when entry value is a double regardless of inclusion of fractional -component +JSON Number with a decimal and fractional +component, or when entry value is a double regardless of inclusion of +fractional component | -double +A double. | ||
-boolean +A boolean. | |||
-null +A null value. |
-Implementers consuming JSON are advised to ensure that their algorithms are -aligned with the +All implementers creating conforming consumers that produce JSON +representations are advised to ensure that their algorithms are aligned +with the JSON -consumption rules in the [[INFRA]] specification. +conversion rules in the [[INFRA]] specification and the precision advisements regarding Numbers in the +JSON [[RFC7159]] specification.
+
-Note that the @context
object member, if present, will not have
-additional processing applied to its value, which will be added verbatim to the
-data model.
+If media type information is available to a conforming consumer and the
+media type value is application/did+json
: the data structure
+being consumed is a DID document and the root element MUST be a JSON Object where all members of the object
+are entries of the DID document. A conforming consumer for a JSON
+representation that is consuming a DID document with a root
+element that is not a JSON Object MUST
+report an error.