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

Class for top-level JSON Array has an root property #3

Closed
MarkusHorstmann opened this issue Jul 8, 2020 · 2 comments
Closed

Class for top-level JSON Array has an root property #3

MarkusHorstmann opened this issue Jul 8, 2020 · 2 comments

Comments

@MarkusHorstmann
Copy link

[
{
"prop1": "value1"
}
]

Results in:
// Root myDeserializedClass = JsonConvert.DeserializeObject(myJsonResponse);
public class MyArray {
public string prop1 { get; set; }
}
public class Root {
public List MyArray { get; set; }
}

Should be something like:
JsonConvert.DeserializeObject<List>(myJsonResponse);

@Json2CSharp
Copy link
Owner

Makes sense.. no need for the root object if you only have an array.
I'll review this case and see what can i do about it.

Thanks for the valuable input 👍

@Json2CSharp
Copy link
Owner

ill close this for now as this seems like a special case for when you only have an array in place, ill reopen this if its requested again or anyone was interested in doing it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants