【发布时间】:2014-03-07 19:00:01
【问题描述】:
我想弄清楚如何将 Jackson 对象转换为 JSONObject?
我已经尝试过,但我不认为这是正确的方法。
public JSONObject toJSON() throws IOException {
ObjectMapper mapper = new ObjectMapper();
return new JSONObject(mapper.writeValueAsString(new Warnings(warnings)));
}
【问题讨论】: