Skip to content
New issue

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

fix JsonNode deserialising from null #85463

Merged
merged 2 commits into from
May 10, 2023

Conversation

adj123
Copy link
Contributor

@adj123 adj123 commented Apr 27, 2023

Fixes #85172

@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Apr 27, 2023
@ghost
Copy link

ghost commented Apr 27, 2023

Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes #85172

Author: adj123
Assignees: -
Labels:

area-System.Text.Json

Milestone: -

@@ -39,6 +41,10 @@ public static void JsonTypes_Deserialize()
Assert.IsAssignableFrom<JsonValue>(JsonNode.Parse("\"str\""));
Assert.IsAssignableFrom<JsonValue>(JsonNode.Parse(ToUtf8("\"str\"")));
Assert.IsType<JsonElement>(JsonSerializer.Deserialize<object>("\"str\""));

Assert.Null(JsonSerializer.Deserialize<JsonNode>("null"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to

  1. Also test deserializing an object containing a JsonNode property?
  2. Add tests validating the same behavior for JsonObject and JsonArray?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing!

Copy link
Member

@eiriktsarpalis eiriktsarpalis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@eiriktsarpalis
Copy link
Member

@adj123 would you mind responding to the CLA bot as well?

#85463 (comment)

Thanks!

@adj123
Copy link
Contributor Author

adj123 commented May 9, 2023

@dotnet-policy-service agree company="DRW Holdings"

@eiriktsarpalis eiriktsarpalis merged commit c77d916 into dotnet:main May 10, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Jun 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Text.Json community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deserialising null to JsonNode in nested structures fails in System.Text.Json
3 participants