<!DOCTYPE html>
<html lang="en">
<head>
???<meta charset="UTF-8">
???<title>转换</title>
???<script>
???????//stringify:把一个对象转换成对应的字符串
// ???????var arr = [1,2,3,4]
// ???????alert(typeof arr)
// ???????alert(JSON.stringify(arr))
// ???????alert(typeof JSON.stringify(arr))
// ???????var j={left:100}
// ???????alert(typeof j)
// ???????alert(JSON.stringify(j))
// ???????alert(typeof JSON.stringify(j))
???????//parse:把字符串转换成对应的对象
// ???????var s1="[1,2,3,4,5]";
// ???????alert(typeof s1)
// ???????alert(JSON.parse(s1))
// ???????alert(typeof JSON.parse(s1))
???????var s2=‘{"left":100}‘
???????alert(typeof s2)
???????alert(JSON.parse(s2))
???????alert(typeof JSON.parse(s2))
???</script>
</head>
<body>
</body>
</html>
json 里的stringify ?parse的方法
原文地址:http://www.cnblogs.com/mylove0/p/7481832.html