美文网首页
fastjson fastuse

fastjson fastuse

作者: YYYYYY25 | 来源:发表于2020-02-27 16:28 被阅读0次
  • OBJ -> String
    String str = JSONObject.toJSONString(obj);

  • JSONObject -> String
    String str = JSONObject.toJSONString(jobj);
    String str = jobj.toJSONString();

  • String -> JSONObject
    JSONObject jobj = JSONObject.parseObject(str);

  • String -> OBJ
    Teacher teacher = JSONObject.parseObject(str, Teacher.class)
    Teacher teacher = JSONObject.parseObject(str, new TypeReference<Teacher>());

  • *OBJ -> JSONObject
    JSONObject jobj = (JSONObject)JSONObject.toJSON(obj);

相关文章

网友评论

      本文标题:fastjson fastuse

      本文链接:https://www.haomeiwen.com/subject/cckxhhtx.html