1.json对象和json字符串的区别:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script>
//json对象
var person={"name":"tom","sex":"男","age":"24"}//json对象
console.log(person);
/* 在控制台输出
Object
age: "24"
name: "tom"
sex: "男"*/
alert(typeof(person));//object
//json字符串
var b='{"name":"2323","sex":"afasdf","age":"6262"}';//json字符串
console.log(b);//{"name":"2323","sex":"afasdf","age":"6262"}
alert(typeof(b));//string
</script>
</body>
</html>
2.json对象和json字符串的相互转换:
//json对象和json字符串的相互转换
//json字符