I'm trying to deserialize the following JSON (see API documentation) using the JSON-B implementation from Quarkus.
What bugs me here are the dynamically generated numeric keys for multiple JSON objects. I want to deserialize all unknown properties to a Map<Long, MyObject>
. Simply declaring a Map inside the data object won't work.
Jackson seems to support exactly the desired behavior using the @JsonAnySetter
annotation (see documentation).
What I could do is write my own JsonbAdapter
to parse the unknown properties manually, but that seems like a riddiculous amount of work for such a simple task.
How can I deserialize unknown JSON properties to a Map with JSON-B?
{
"634": {
"AT": {
"av": -61.082,
"ct": 314284,
"mn": -94.58,
"mx": -16.136
},
"First_UTC": "2020-09-07T15:29:16Z",
"HWS": {
"av": 6.685,
"ct": 156912,
"mn": 0.452,
"mx": 17.887
},
"Last_UTC": "2020-09-08T16:08:49Z",
"PRE": {
"av": 775.846,
"ct": 159956,
"mn": 746.3902,
"mx": 793.7311
},
"Season": "summer",
},
"635": { ... },
"636": { ... },
"638": { ... },
"sol_keys": [
"634",
"635",
"636",
"638",
],
}