json字符串解析成对象 : var obj = JSON.parse(str)
对象转化成字符串:var str1 = JSON.stringify(obj1)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
// 创建字符串str(格式严格)
var str = '{"name":"jack","age":"100"}'
console.log(str)
// json字符串解析成对象
var obj = JSON.parse(str)
console.log(obj)
// 调用值
console.log(obj.name)
// 前端给后端
var obj1 = {"name":"bob"}
// 对象转化成字符串
var str1 = JSON.stringify(obj1)
console.log(obj1,str1)
</script>
</body>
</html>