I have a JSON array like this:
[
"0",
{
"number": 1,
"field": "value"
},
{
"number": 2,
"field": "value"
}
]
The first element to the array is a string.
Is it possible to deserialize it with FasterXML Jackson?
I know how to do it with different objects.
I need to use @JsonSubTypes
(Here is an example https://stackoverflow.com/a/38877862/2564509 )
The problem with this array is that the first element is String type.
Caveat: Your situation is an unfortunate edge case. As such, the solution is likely to be not wonderful.
This works, but is not wonderful:
List<Object>
. In your case, this will result in a List of three elements; String, LinkedHashMap, and LinkedHashMap
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.