node--字符串JSON和String转换 2017-09-11 字符串转换模块 stringify 将json 转换为字符串,序列化对象,将对象类型转换为字符串类型,字符有默认分隔符(“&”),分配符:”=” 123456789101112var querystring = require('querystring');var data = { foo:'ee', cool : ['r','t']};var result = querystring.stringify(dtaa);console.log(result);// foo=ee&cool=r&cool=t; stringify 的多参数用法 1234var result = querystring.stringify({foo:'bar',cool:['xux', 'yys']},'*','$');//'foo$bar*cool$xux*cool$yys' parse 序列化 将字符转化为对象类型 12345 var querystring = require('querystring');var result = querystring.parse('foo=bar&cool=xux&cool=yys');console.log(result); Please enable JavaScript to view the comments powered by Disqus.