I have the following Java bean class with gets converted to JSON using Jackson.
public class Thing {
public String name;
@JsonRawValue
public Map content = new HashMap();
}
content
is a map who's values will be raw JSON from another source. For example:
String jsonFromElsewhere = "{ \"foo\": \"bar\" }";
Thing t = new Thing();
t.name = "test";
t.content.put("1", jsonFromElsewhere);
The desired generated JSON is:
{"name":"test","content":{"1":{ "foo": "bar" }}}
However using @JsonRawValue
results in:
{"name":"test","content":{1={ "foo": "bar" }}}
What I need is a way to specify @JsonRawValue
for only for the Map's value. Is this possible with Jackson?