The document discusses JSON (JavaScript Object Notation), which is a lightweight format for exchanging data between a client and server. It notes that JSON is easy for humans to read and write, and easy for machines to parse and generate. The document outlines the syntax of JSON, including that objects use curly braces, members use key-value pairs separated by commas, and arrays use square brackets. It also discusses parsing and accessing JSON data.
In this document
Powered by AI
Overview of JSON, its basic characteristics, and agenda for the presentation.
Definition of JSON, its lightweight nature, ease of use and reading, and advantages over XML.
Explanation of JSON syntax, including object and array structures with examples.
Methods to parse JSON and access its data using dot notation in JavaScript.
Open floor for questions regarding the presentation on JSON.
What is JSON?Standsfor JavaScript Object NotationIs lightweight format for exchanging data between the client and server.Easy for humans to read and write.Easy for machines to parse and generate Often used in Ajax applications due toIts simplicityits format which is based on JavaScript object literals
4.
Why JSON?JSON isrecognized natively by JavaScriptSimple formatThe easiness of reading The easiness of using Lighter than XML
JSON SyntaxFor objectsstart the object with “{“ and end it with “}” For members (properties), use pairs of string : value and separate them by commas For arrays put the arrays between [] For elements put the values directly separated by commas
8.
Example var myFirstJSON={ "firstName" : "John",   "lastName" : "Doe",   "age"    : 23 };
9.
JSON ParserYou canconvert JSON object into JSON textObject to Text Conversion var myJSONText = myObject.toJSONString();
10.
Accessing Data inJSONThe most common way to access JSON data is through dot notation. var myObject = { 'color' : 'blue' };document.writeln(myObject.color);