Help to deserialize complex JSON
See original GitHub issueI need to deserialize this JSON:
{
"emails": {
"items": [
{
"id": 1,
"email": "john@doe.com"
},
{
"id": 2,
"email": "jane@doe.com"
}
]
}
}
Into this object using Marshmallow:
{
"emails": [
{
"id": 1,
"email": "john@doe.com"
},
{
"id": 2,
"email": "jane@doe.com"
}
]
}
How can I do it?
I tried this way, which I found more intuitive, but it did not work:
class Phone(OrderedSchema):
id = fields.Int()
email = fields.Str()
class Contact(Schema):
key = fields.Str()
phones = fields.Nested(Phone, load_from='phones.list', many=True)
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (6 by maintainers)
Top Results From Across the Web
How to Deserialize a Complex JSON Object in C# .NET
In this article, we are gonig to learn how to deserialize a complex JSON object using C# as our language of choice.
Read more >How do I deserialize a complex JSON object in C# .NET?
var jobject = JsonConvert.DeserializeObject<RootObject>(jsonstring);. You can paste the json string to here: http://json2csharp.com/ to check ...
Read more >Serialize and Deserialize complex JSON in Python
JSON Object is defined using curly braces{} and consists of a key-value pair. It is important to note that the JSON object key...
Read more >Deserializing The Complex JSON Object In C# - C# Corner
Serializing and deserializing the JSON object in C# is pretty simple with Newtonsoft.Json NuGet package in C#. In this blog, I'm going to ......
Read more >How to: Deserialization of nested JSON - Dofactory
How to: Deserialization of nested JSON. I am receiving the JSON formatted string from a web service over the Internet. It is roughly...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Pluck
is work in progress. It is not available yet.What version of marshmallow are you using? Can you edit your example so that the data and the schema match?