Reputation: 3323
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.
Upvotes: 0
Views: 1852
Reputation: 38290
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 LinkedHashMapUpvotes: 2