JSON Introduction

Click Here

JSON means JavaScript Open Notation.

JSON is an alternative to XML format.

JSON is a format for storing and exchanging data.

JSON is self-descriptive and easy to use.

JSON is just text so it can be used from any programming language.

JSON is faster to read and write XML format.

JSON can be used with HTTPRequest.

JSON can be used with AJAX.

JSON example

{"contacts":[ {"firstName":"Adam", "lastName":"Smith"}, {"firstName":"Anne", "lastName":"Davis"}, {"firstName":"Bruce", "lastName":"Harris"}, {"firstName":"David", "lastName":"Lee"} ]}

Example JSON object handling with javascript

<h2>JSON with JavaScript</h2> <p id="data"></p> <script> var text = '{"firstName":"Adam","lastName":"Smith","age":"30"}' var obj = JSON.parse(text); document.getElementById("data").innerHTML = obj.firstName + "<br/>" + obj.lastName + "<br/>" + obj.age; </script>

Click Here