Skip to content

Commit e4006f0

Browse files
authored
Add note about allowing out of order metadata properties (#10587)
1 parent 9193540 commit e4006f0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

xml/System.Text.Json.Serialization/ReferenceHandler.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@
135135
136136
* For the metadata properties within the JSON to be considered well-formed, they must follow these rules:
137137
138-
* The `$id` metadata property must be the first property in the JSON object.
138+
* Unless <xref:System.Text.Json.JsonSerializerOptions.AllowOutOfOrderMetadataProperties> is set to `true`, the `$id` metadata property must be the first property in the JSON object.
139139
* A JSON object that contains a `$ref` metadata property must not contain any other properties.
140140
* The value of the `$ref` metadata property must refer to an `$id` that has appeared earlier in the JSON.
141141
* The value of the `$id` and `$ref` metadata properties must be a JSON string.
142-
* For enumerable types, such as <xref:System.Collections.Generic.List%601>, the JSON array must be nested within a JSON object containing an `$id` and `$values` metadata property, in that order.
142+
* For enumerable types, such as <xref:System.Collections.Generic.List%601>, the JSON array must be nested within a JSON object containing an `$id` and `$values` metadata property, in that order. (However, the order is not important if <xref:System.Text.Json.JsonSerializerOptions.AllowOutOfOrderMetadataProperties> is set to `true`.)
143143
* For enumerable types, the `$values` metadata property must be a JSON array.
144144
* The `$values` metadata property is only valid when referring to enumerable types.
145145

0 commit comments

Comments
 (0)