The json format is very suitable for simple objects with some properties and values. Here is a simple example:
]
<script>
var person={ //json对象定义开始
name:"脚本之家", //字符串
url:"www.jb51.net", //数字
age:"3",
married:false, //布尔值
books:[ //数组,在数组中又嵌入了两个json对象
{name:"javascript",price:30},
{name:"正则表达式",price:25}
]
}
alert(person.books);
alert(person.name+" "+person.url+" "+person.age+" "+person.books[0]["name"]);
</script>The json object was successfully run and obtained Internal property value. It can be seen that the json object is very simple and easy to learn.
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn