professional-ajax-07-General-JSON-Examples-JSONDecodingExample.htm / htm
<html> <head> <title>JSON Example</title> <script type="text/javascript" src="json.js"></script> </head> <body> <script type="text/javascript"> var sJSON = "{\"availableColors\" : [ \"red\", \"white\", \"blue\" ],\"availableDoors\" : [ 2, 4 ]}" var oCarInfo = JSON.parse(sJSON); alert(oCarInfo.availableColors[0]); //outputs "red" alert(oCarInfo.availableDoors[1]); //ouputs "4" </script> </body> </html>
(C) Æliens 20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.