Reputation: 2454
I am trying to use jackson to convert a pojo to json. The json that I need to generate has the following structure -
"paragraphs": [
{
"text": "This is a test text",
"page/pages": "1/56",
}
Notice how one of the items is "page/pages", but I cannot directly creating a variable name in POJO with the same name. How do I generate the JSON in the above format if slash is not allowed in variable name in java?
Upvotes: 0
Views: 252
Reputation: 1648
Try an annotation e.g.
@JsonProperty("page/pages")
public String pages;
Upvotes: 1