I have a Jersey client that makes a call to a 3rd party rest api and retrieves some JSON.
{"A":1,"W":2,"List":[{"name":"John","amount":10.0}]}
After that I need to append this JSON to my response class and give it back in the response.
@XmlRootElement
public class MyResponse {
private JsonObject body;
private String status;
I manage to assign the value that comes from the 3rd party api to body
but the response that's sent is like this:
{
"status": "success",
"body": {
"entry": [
{
"key": "A",
"value": 1
} ,
{
"key": "W",
"value": 2
},
{
"key": "List",
"value": "[{\"name\":\"John\",\"amount\":10.0}]"
}
]
}
}
So there are two main issues, moxy is generating key
and value
elements while I would like it to be key: value
and also it is not generating properly the 2nd level objects in the JSON structure provided by the API.