JacksonObjectMapper implements ObjectMapper { @Override public String writeValue(Object value) { try { return om.writeValueAsString(value); } catch (JsonProcessingException e) { throw new UnirestException(e); } } JacksonObjectMapper();  JacksonObjectMapper(com.fasterxml.jackson.databind.ObjectMapper om); @Override T readValue(String value, Class<T> valueType); @Override T readValue(String value, GenericType<T> genericType); @Override String writeValue(Object value);  }
@Test public void canWrite() throws JSONException { TestMe test = new TestMe("foo", 42, new TestMe("bar", 666, null)); String json = om.writeValue(test); JSONAssert.assertEquals( "{\"text\":\"foo\",\"nmbr\":42,\"another\":{\"text\":\"bar\",\"nmbr\":666,\"another\":null}}" , json , true ); }