Java list转json串的问题

来源:互联网 发布:python def函数用法 编辑:程序博客网 时间:2024/05/16 02:13

http://jingyan.baidu.com/article/1612d5004686f0e20e1eeeba.html


准备包:

commons-beanutils-1.8.0.jar

commons-collections-3.1.jar

commons-lang.jar

commons-lang3-3.1.jar

json-lib-2.4-jdk15.jar

jsonplugin-0.32.jar

ezmorph-1.0.6.jar


其中lang包估计是版本 我这里要用两个才能用!



然后在选中工程-》右键-》build path -> config build path -> Java build path ->libraries-> add jar ->finsh

在代码中加入

List li = impl.getObjList();

JSONArray jsonArray = JSONArray.fromObject(li);

crtl+shift+o导入

import net.sf.json.JSONArray;

[{"activeStatus":1,"activeTime":120,"corpCode":"","corpId":1,"cpAllParentIds":",1,"}]


0 0
原创粉丝点击