Parent tag is missing from JSON
I have this DTO to be converted to XML/JSON and send response to client fro开发者_Go百科m my web service. We are using Jersey.
@XmlRootElement(name = "response")
public class Response {
@XmlValue
private String value="true";
}
It is getting properly converted to XML,
<response>true</response>
but json is missing out the parent tag,
it is outputting true
instead of response:true
Is anybody having the same problem?
Values don't get modified with the parent names. One thing is metadata (tags), and other thing is data, that doesn't get modified.
It is actually because we are omitting parent tag while outputing JSON. Just in this case omitting parent tag is causing problem as there is only one value in the object.
精彩评论