How to generate an empty json node using jackson-java. I tried with NullNode.instance, but that returns
"totals":null
Whereas I want totals to be an empty instance.
{
"totals": {},
"orderId": "550047004",
"numberOfItems": 2
}
You should use ObjectNode
. It can be created with ObjectMapper
:
ObjectNode node = mapper.createObjectNode();
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