JsonProcessor { public String generate(Object object) { StringWriter writer = new StringWriter(); JsonGenerator generator = null; try { try { generator = getJsonFactory().createJsonGenerator(writer); if (isIndentOutput()) { generator.useDefaultPrettyPrinter(); } writeAny(generator, new IdentityHashMap<Object, Object>(), object); } finally { if (generator != null) { generator.close(); } } } catch (IOException ex) { throw new IllegalStateException(ex); } return writer.toString(); }  JsonFactory getJsonFactory(); void setJsonFactory(JsonFactory factory); Converter getConverter(); void setConverter(Converter converter); @Deprecated Transformer getTransformer(); @Deprecated void setTransformer(Transformer transformer); boolean isIndentOutput(); void setIndentOutput(boolean isIndentOutput); Object parse(InputStream stream); Object parse(Reader reader); Object parse(String string); Object parse(byte[] bytes); String generate(Object object);  }
@Test public void test_generate_indent1() { JsonProcessor processor = new JsonProcessor(); Class1 object = new Class1(); object.string1 = "string1"; assertEquals( "{\"string1\":\"string1\",\"string2\":null,\"string3\":null,\"date1\":null}", processor.generate(object)); }