How can I include raw JSON in an object using Jackson?
问题 I am trying to include raw JSON inside a Java object when the object is (de)serialized using Jackson. In order to test this functionality, I wrote the following test: public static class Pojo { public String foo; @JsonRawValue public String bar; } @Test public void test() throws JsonGenerationException, JsonMappingException, IOException { String foo = "one"; String bar = "{\"A\":false}"; Pojo pojo = new Pojo(); pojo.foo = foo; pojo.bar = bar; String json = "{\"foo\":\"" + foo + "\",\"bar\":"