qs.stringify() 和JSON.stringify()的区别

时间:2021-09-23 06:52:05
var a = {name:'hehe',age:10};
qs.stringify(a)
// 'name=hehe&age=10' JSON.stringify(a) // '{"name":"hehe","age":10}' var a = '{name:"hehe",age:10}';
qs.parse(a)
//{ '{name:"hehe",age:10}': '' }
JSON.parse(c)       //{ name: 'hehe', age: '10' }
var a=[{a:123},{a:345}]
qs.stringify(a)  //'0[a]=123&1[a]=345'