We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The following test fails with both JsonElement and JsonNode type handling.
JsonElement
JsonNode
[Theory] [InlineData(JsonUnknownTypeHandling.JsonElement)] [InlineData(JsonUnknownTypeHandling.JsonNode)] public void ObjectConverterShouldHandleReferenceMetadata(JsonUnknownTypeHandling typehandling) { var options = new JsonSerializerOptions { ReferenceHandler = ReferenceHandler.Preserve, UnknownTypeHandling = typehandling }; string json = @"[{ ""$id"" : ""1"" },{ ""$ref"" : ""1""}]"; object[] deserialized = JsonSerializer.Deserialize<object[]>(json, options); Assert.Same(deserialized[0], deserialized[1]); }
We need to update the TryGetReferenceFromJsonElement method in ObjectConverter:
TryGetReferenceFromJsonElement
ObjectConverter
runtime/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Object/ObjectConverter.cs
Lines 43 to 48 in f8d5706
so that it handles both $id and $ref metadata. We also need to expose equivalent functionality for JsonNode, which currently is not implemented.
$id
$ref
cc @jozkee @steveharter
The text was updated successfully, but these errors were encountered:
Tagging subscribers to this area: @dotnet/area-system-text-json See info in area-owners.md if you want to be subscribed.
area-System.Text.Json, untriaged
area-System.Text.Json
untriaged
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
The following test fails with both
JsonElement
andJsonNode
type handling.We need to update the
TryGetReferenceFromJsonElement
method inObjectConverter
:runtime/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Object/ObjectConverter.cs
Lines 43 to 48 in f8d5706
so that it handles both
$id
and$ref
metadata. We also need to expose equivalent functionality forJsonNode
, which currently is not implemented.cc @jozkee @steveharter
The text was updated successfully, but these errors were encountered: