JS中json数据格式取值实例
<html> <head> <title>Json数据格式强大</title> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <script type="text/javascript"> var pepole={ "pragrammers":[ {"name":"效果","age":"6"}, {"firstname":"小狗","age":"79"}], "write":[ {"name":"路沃恩","time":"2012-04-10"}, {"love":"cat","time":"2012-09-43"} ], "pig":"飞天神猪" } window.alert(pepole.pragrammers[1].firstname);//拿到小狗的值 window.alert(pepole.pig);//拿到飞天神猪 alert(pepole.write[1].love);//拿到cat </script> </head> <body> </body> </html>