`
yiminghe
  • 浏览: 1431683 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

JSON marsh && unmarsh

阅读更多

Ext 端用

 


//Encodes an Object, Array or other value 
Ext.util.JSON.encode
(Mixed o) : String 

//Decodes (parses) a JSON string to an object. If the JSON is invalid, this 
//function throws a SyntaxError.
Ext.util.JSON.decode
(String json) : Object 
 

 

 

Java 端用

//json-lib
//params 例如"{xx:'yy'}";

JSONObject jsonParams = JSONObject.fromObject(params);

String xx= jsonParams.getString("xx");

 

 

//json-lib
JSONSerializer.toJSON(javabean || list of javabean).toString();

//return string
{xx:yy}   or  [{xx:yy},{xx2:yy2}]  

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics