topical media & game development

talk show tell print

professional-ajax-07-General-JSON-Examples-JSONDecodingExample.htm / htm

          <title>JSON Example</title>
          <script type="text/javascript" src="json.js"></script>
          <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"

(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.