日期:2014-05-17 浏览次数:20687 次
private String toJson(Map<String, String> areas) {
JsonFactory f = new JsonFactory();
StringWriter out = new StringWriter();
try {
JsonGenerator g = f.createJsonGenerator(out);
ObjectMapper m = new ObjectMapper();
m.writeValue(g, areas);
return out.toString();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}