I have a class which is basically a wrapper for a HashMap. I would like to serialize this class with Jackson to an JSON object without any wrapping element.
public class Customers {
@JsonProperty
private Map<String,Customer> customers = new HashMap<>();
...
}
Current serialization looks like this:
{
"Customers":{
"customers":{
"keyX":{...},
"keyY":{...},
"keyZ":{...}
}
But I want to have this:
{
"keyX":{...},
"keyY":{...},
"keyZ":{...}
}
How can I reach it?
Try @JsonUnwrapped on the property Customers this can help you unwrap a nested level
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With