fastjson

作者: xuyouxin1 | 来源:发表于2017-08-21 16:31 被阅读0次

    1、JSONObject:json对象

    属性:Map<String, Object> map,键值对实际存在该map中

    方法:

    实际用map的方法实现的有:size,isEmpty,containsKey,containsValue,get,put,clear,remove,keySet,entrySet

    toString、toJSONString:json对象转为json串

    toJavaObject:json对象转为java对象

    getJSONObject:获取JSONObject对象

    getJSONArray:获取JSONArray对象

    getString:获取String对象

    getInteger:获取int值

    getLong:获取long值

    getDouble:获取double值

    等等

    2、JSONArray:json数组

    属性:List<Object> list,对象实际存在该list中

    方法:

    实际用list的方法实现的有:size,isEmpty,contains,iterator,add,remove,addAll,removeAll,clear,get

    toString、toJSONString:json数组转为json串

    getJSONObject:获取JSONObject对象

    getJSONArray:获取JSONArray对象

    getString:获取String对象

    getInteger:获取int值

    getLong:获取long值

    getDouble:获取double值

    3、JSON:json操作

    Object parse(String text):解析json串,得到Object对象

    JSONObject parseObject(String text) :解析json串,得到JSONObject对象

    T parseObject(String text, Classclazz):解析json串,得到指定类的对象

    JSONArray parseArray(String text):解析json串,得到JSONArray对象

    List  parseArray(String text, Classclazz):解析json串,得到指定类的对象列表

    String toJSONString(Object object):Object转String

    Object toJSON(Object javaObject):java对象转为json对象

    T toJavaObject(JSON json, Classclazz):json对象转为java对象

    相关文章

      网友评论

          本文标题:fastjson

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