You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It should be possible to parse an array of objects even if the corresponding value in the dictionary is not an array. A use case is as follows: you parse xml that is designed to be an array but only has a single element. The xml parser has no knowledge of the array intention, and most will just parse this to a dictionary, not an array of one element. This library, however, can actually convert these properly with no additional configuration as it knows the target property is an array type. To clarify further with an example:
This json can be parsed into a user with an array of one tweet:
However, this too should be parseable as a user with an array of one tweet (provided you specify an array mapping for property "tweets" of course), but I don't see a way to do it currently:
Can I add a request for this as well. I have a very similar issue whereby our JSON we get back can either be a list of "tweets" or a single "tweet", like so:
{
"tweet" : {
"id_str": 190957570511478800,
"text": "Tweet text"
}
It should be possible to parse an array of objects even if the corresponding value in the dictionary is not an array. A use case is as follows: you parse xml that is designed to be an array but only has a single element. The xml parser has no knowledge of the array intention, and most will just parse this to a dictionary, not an array of one element. This library, however, can actually convert these properly with no additional configuration as it knows the target property is an array type. To clarify further with an example:
This json can be parsed into a user with an array of one tweet:
{
"name": "Diego Chohfi",
"tweets": [
{
"id_str": 190957570511478800,
"text": "Tweet text"
}
]
}
However, this too should be parseable as a user with an array of one tweet (provided you specify an array mapping for property "tweets" of course), but I don't see a way to do it currently:
{
"name": "Diego Chohfi",
"tweets":
{
"id_str": 190957570511478800,
"text": "Tweet text"
}
}
The text was updated successfully, but these errors were encountered: