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

Cannot Deserialize into Nested Class #35921

Closed
tlbaxter opened this issue May 6, 2020 · 4 comments
Closed

Cannot Deserialize into Nested Class #35921

tlbaxter opened this issue May 6, 2020 · 4 comments

Comments

@tlbaxter
Copy link

tlbaxter commented May 6, 2020

I have a class structure like this:

public class A {
// some stuff....
public class B {
// some more stuff...
}
}

If I have a json string I should, I think, be able to do this:

A.B ab = JsonSerializer.Deserialize<A.B>(someJsonString);

The ab variable is not populated. If I move B outside of A. It works. Why is this?

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added area-System.Text.Json untriaged New issue has not been triaged by the area owner labels May 6, 2020
@ghost
Copy link

ghost commented May 6, 2020

Tagging subscribers to this area: @jozkee
Notify danmosemsft if you want to be subscribed.

@layomia layomia removed the untriaged New issue has not been triaged by the area owner label May 6, 2020
@layomia layomia added this to the 5.0 milestone May 6, 2020
@layomia
Copy link
Contributor

layomia commented May 6, 2020

It seems like you want an API to deserialize into an existing object. Can you see if #29538 expresses your ask? Please feel free to re-open if not.

@layomia layomia closed this as completed May 6, 2020
@tlbaxter
Copy link
Author

tlbaxter commented May 7, 2020

It seems like you want an API to deserialize into an existing object. Can you see if #29538 expresses your ask? Please feel free to re-open if not.

Please re-open. Issue #29538 has nothing to do with what i am talking about. I do not know how to re-open.

@layomia
Copy link
Contributor

layomia commented May 7, 2020

My mistake. I see you opened #35957. Thanks.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants