/** Simple JSON encode */
public static Func1<JsonObject, Buffer> encodeJson(final String charset) {
return new Func1<JsonObject,Buffer>() {
public Buffer call(JsonObject in) {
try {
return new Buffer(in.encode().getBytes(charset));
}
catch (UnsupportedEncodingException e) {
throw new RuntimeException("Unable to encode JSON (charset="+charset+")",e);
}
}