JSONObject json
2016-07-08 12:53
381 查看
1、为什么model里面的类都要继承JSONObject:
一个功能强大的串行化库
支持json,xml,等
这个就关系到了json的应用了
轻量级数据交换格式
JSONObject:
可以输出
public static void main(String[] args) {
Map<String,Object> map = new HashMap<String,Object>();
map.put("int", new Integer(1));
map.put("brr",new int[]{1,2,2});
map.put("arr",new int[]{1,2,2});
map.put("fun", "function(i){return this.arr}");
JSONObject json =
JSONObject.fromObject(map);
System.out.println(json);
}
输出:(默认排序是根据key的首字母排序):{"arr":[1,2,2],"int":1,"brr":[1,2,2],"fun":function(i){return this.arr}}
import com.alibaba.fastjson.JSONObject;
与其他的有什么不同之处
一个功能强大的串行化库
支持json,xml,等
这个就关系到了json的应用了
轻量级数据交换格式
JSONObject:
可以输出
public static void main(String[] args) {
Map<String,Object> map = new HashMap<String,Object>();
map.put("int", new Integer(1));
map.put("brr",new int[]{1,2,2});
map.put("arr",new int[]{1,2,2});
map.put("fun", "function(i){return this.arr}");
JSONObject json =
JSONObject.fromObject(map);
System.out.println(json);
}
输出:(默认排序是根据key的首字母排序):{"arr":[1,2,2],"int":1,"brr":[1,2,2],"fun":function(i){return this.arr}}
import com.alibaba.fastjson.JSONObject;
与其他的有什么不同之处
相关文章推荐
- ProtocolBuffer for Objective-C 运行环境配置及使用
- Windows下的Objective-C集成开发环境(IDE)
- [翻译]Objective-C 2015新特性
- ProtocolBuffer for Objective-C 运行环境配置及使用
- Objective-C字符串处理方法大全
- Call to a member function display() on a non-object问题的解决
- iOS开发必读-GitHub 上Top100 的 Objective-C 项目
- 李洪强iOS开发之【Objective-C】09-空指针和野指针
- Error:Cannot locate factory for objects of type DefaultGradleConnector, as ConnectorServiceRegistry
- Jackson框架的JsonGenerator、ObjectMapper - Json-lib框架的JsonObject、JsonArray
- git“fatal: loose object”错误解决办法汇总
- JSON利用superobject进行资料交换及重新封装ClientDataSet
- 全面解析Objective-C中的block代码块的使用
- 不变对象(Immutable Objects)
- 【数据库】sql server中的sys.sysobjects系统表
- Objective-C的hook方案(一): Method Swizzling
- Objective-C的hook方案(一): Method Swizzling
- Objective-C——类的本质
- java基础学习总结——Object类
- Objective-C——Block的使用