際際滷

際際滷Share a Scribd company logo
JSON  Basics    Shyamala Prayaga
AgendaWhat is JSON?Why JSON?Pros and ConsJSON SyntaxJSON ParserAccessing Data in JSON
What is JSON?Stands for 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
Why JSON?JSON is recognized natively by JavaScriptSimple formatThe easiness of reading The easiness of using Lighter than XML
Benefits over XML
Pros and Cons
JSON SyntaxFor objects start 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
Example var myFirstJSON ={       "firstName" : "John",   "lastName" : "Doe",   "age"       : 23 };
JSON ParserYou can convert JSON object into JSON textObject to Text Conversion    var myJSONText = myObject.toJSONString();
Accessing Data in JSONThe most common way to access JSON data is through dot notation.   var myObject = { 'color' : 'blue' };document.writeln(myObject.color);
Questions?

More Related Content

Json

  • 1. JSON Basics Shyamala Prayaga
  • 2. AgendaWhat is JSON?Why JSON?Pros and ConsJSON SyntaxJSON ParserAccessing Data in JSON
  • 3. What is JSON?Stands for 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 is recognized natively by JavaScriptSimple formatThe easiness of reading The easiness of using Lighter than XML
  • 7. JSON SyntaxFor objects start 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 can convert JSON object into JSON textObject to Text Conversion var myJSONText = myObject.toJSONString();
  • 10. Accessing Data in JSONThe most common way to access JSON data is through dot notation. var myObject = { 'color' : 'blue' };document.writeln(myObject.color);