public String getJsonString(Object o){
ObjectMapper om = new ObjectMapper();
StringWriter sw = new StringWriter();
try{
JsonGenerator jg = new JsonFactory().createJsonGenerator(ws);
om.writeValue(jg,o);
jg.close();
}catch(){}
return ws.toString() ;
} public void writeJson(Object o) {
String json = getJsonString(o);
try{
ServletActionContext.getResponse().getWriter().write(json);
}catch(){}
}