public Object convert(Object obj) {
StringBuilder sb = new StringBuilder();
Writer writer = new StringWriter(sb);
try {
new JsonRenderImpl(writer, format).render(obj);
writer.flush();
return sb.toString();
} catch (IOException e) {
throw Lang.wrapThrow(e, JsonException.class);
}