Jira 10, Platform 7, JDK17, REST V2 Demo App
curl -u admin:admin http://localhost:8080/rest/jira-rest-app-demo/1/demo/orders
[
{
"orderId": "O-one",
"customerId": "C-1",
"subOrder": {
"subOrderType": "shipping",
"subOrderDetails": "customer want's it fast!"
}
},
{
"orderId": "O-two",
"customerId": "C-2",
"subOrder": {}
},
{
"orderId": "O-three"
}
]
✅ How it should look:
[
{
"orderId": "O-one",
"customerId": "C-1",
"subOrder": {
"subOrderType": "shipping",
"subOrderDetails": "customer want's it fast!"
}
},
{
"orderId": "O-two",
"customerId": "C-2",
"subOrder": {
"subOrderType": null,
"subOrderDetails": null
}
},
{
"orderId": "O-three",
"customerId": null,
"subOrder": {
"subOrderType": null,
"subOrderDetails": null
}
}
]
✅ SOLVED: By using @XmlElement(nillable = true)
on the right elements
[
{
"orderId":"O-one",
"customerId":"C-1",
"subOrder":{
"subOrderType":"shipping",
"subOrderDetails":"customer want's it fast!"
}
},
{
"orderId":"O-two",
"customerId":"C-2",
"subOrder":{
"subOrderType":null,
"subOrderDetails":null
}
},
{
"orderId":"O-three",
"customerId":null,
"subOrder":null
}
]