WebApi接口传参不再困惑:传参详解

https://blog.csdn.net/leeyue_1982/article/details/51305950

 

序列化:JSON.stringify(obj)

反序列化:$.parseJSON(str)

 

js.Serialize(stu);//序列化
js.Deserialize //反序列化

 

var obj = {a: 'hello', b: 'wolrd'};
var jsonString = JSON.stringify(a); // "{"a":"hello","b":"world"}"
var jsonObj = JSON.parse(jsonString); // object {"a":"hello","b":"world"}


var v11 = $.param( { name:"CodePlayer", age:18 } ); // "name=CodePlayer&age=18"

var res = {};
var v11 = $.param( { name:"CodePlayer", age:18 } );
v11.split('&').forEach(function(i){
var j = i.split('=');
res[j[0]]=j[1];
});
console.log(JSON.stringify(res));//'{"name":"CodePlayer","age":"18"}'

posted on 2018-06-16 08:35  JH-江华  阅读(179)  评论(0编辑  收藏  举报

导航