HLJ 发布于
2019-04-23 10:47:45

JSON.stringify()方法将JavaScript对象或值转换为JSON字符串

JSON.stringify()方法将JavaScript对象或值转换为JSON字符串
<script type="text/javascript">
console.log(JSON.stringify({ x: 5, y: 6 }));
console.log(JSON.stringify([new Number(3), new String('false'), new Boolean(false)]));
console.log(JSON.stringify({ x: [10, undefined, function(){}, Symbol('')] }));
console.log(JSON.stringify(new Date(2006, 0, 2, 15, 4, 5)));
</script>
输出结果:{"x":5,"y":6}
输出结果:[3,"false",false]
输出结果:{"x":[10,null,null,null]}
输出结果:"2006-01-02T07:04:05.000Z"
当前文章内容为原创转载请注明出处:http://www.good1230.com/detail/2019-04-23/404.html
最后生成于 2023-08-04 21:36:19
此内容有帮助 ?
0