gson问题
wiseph
这个作者很懒,什么都没留下…
展开
-
com.google.gson string to JsonObject
gson 中字符串转换为json数据: String testString="'bgColorPc ':'red'"; JsonObject jsondetail = new JsonParser().parse(testString).getAsJsonObject(); String bgColorPc = jsondetail.get("bgColorPc").getAsStrin原创 2016-09-27 14:33:22 · 3732 阅读 · 1 评论 -
JSON格式的String 转成 net.sf.json.JSONObject
String jstr="{'json':'jsonvalue','bool':true,'int':1,'double':'20.5'}"; JSONObject json=JSONObject.fromObject(jstr); boolean bool=json.getBoolean("bool"); int i=json.getInt("int"); double d=json.getDo转载 2016-09-27 15:07:40 · 1012 阅读 · 0 评论 -
不同包的json的用法
1: import com.alibaba.fastjson.JSON; (1);将对象转化为json字符串 String jsonObject=JSON.toJSONString(Object object); (2):将json字符串转换为对象 ① 将String转换为对象 Object object=JSON.parse(String text); JSONObject js原创 2016-10-17 09:32:32 · 299 阅读 · 0 评论