An Introduction to JSON                             Ahmed Muzammil | @ahmedmzlJavaScript Object Notation                  ...
Whats inside                     Introducing JSON                         Why JSON                      JSON Structures   ...
JavaScript Object NotationThe fat free alternative to XML                                  www.ahmedmzl.com | Ahmed Muzamm...
Why JSON ??• Its easy for humans to read and write• Its also easy for computers to read and parse• JSONs structure is sign...
JSON objects are "typed" vs. XML is "typeless"        XML                         JSON         All       Strings          ...
JSON   JavaScript Object Notation                www.ahmedmzl.com | Ahmed Muzammil Jamal ] LinkedIn ] @ahmedmzl
JSON ➡ Native data form for JavaScript • Data is readily accessible   • XML data needs parsing   as JSON objects          ...
JSON is built on two structures• A collection of name/value pairs   • Realization (as in various programming languages)   ...
Data Storage In JSON• Object• Array                       www.ahmedmzl.com | Ahmed Muzammil Jamal ] LinkedIn ] @ahmedmzl
JSON :: Object• Example var myJSONObject =   { “Fruits” :                                     [                           ...
JSON :: Array• Example var myJSONArray = [                    “Apple” ,                    “Orange”,                    “G...
JSON Values              www.ahmedmzl.com | Ahmed Muzammil Jamal ] LinkedIn ] @ahmedmzl
JSON String • A string is very much like a C or Java string.     • string is a collection of zero or more Unicode characte...
JSON Number• A number is very much like a C or Java number  ! octal and hexadecimal formats are not used.Eg.12345671.32432...
JSON Tools for Developers• Available for download @ www.json.org• Parser  Parse JSON text files and convert these to a Java...
Where is JSON Used?• Ajax applications / Web 2.0• Represent configuration information• Implement communication protocols• D...
Let’s end with an example JSON {   "firstName": "John",     "lastName": "Smith",     "age": 25,     "address":    {       ...
The same Example in XML <Object> <Property><Key>firstName</Key> <String>John</String></Property> <Property><Key>lastName</K...
Want more of JSON ? Go here...• Introducing JSON  - http://www.json.org/• Introduction to JSON  - http://www.javapassion.c...
JSON is GOOD !• Like this presentation? Share it...• Questions?  - Tweet me @ahmedmzl• I can help you on:                 ...
Upcoming SlideShare
Loading in …5
×

An Introduction to JSON JavaScript Object Notation

3,313 views
2,972 views

Published on

JSON (JavaScript Object Notation), is a text-based open standard designed for human-readable data interchange. It is derived from the JavaScript scripting language for representing simple data structures and associative arrays, called objects.

Despite its relationship to JavaScript, it is language-independent, with parsers available for many languages.

The JSON format was originally specified by Douglas Crockford, and is described in RFC 4627. The official Internet media type for JSON is application/json. The JSON filename extension is .json.

The JSON format is often used for serializing and transmitting structured data over a network connection. It is used primarily to transmit data between a server and web application, serving as an alternative to XML.

Published in: Technology
3 Comments
4 Likes
Statistics
Notes
No Downloads
Views
Total views
3,313
On SlideShare
0
From Embeds
0
Number of Embeds
144
Actions
Shares
0
Downloads
87
Comments
3
Likes
4
Embeds 0
No embeds

No notes for slide

An Introduction to JSON JavaScript Object Notation

  1. An Introduction to JSON Ahmed Muzammil | @ahmedmzlJavaScript Object Notation www.ahmedmzl.com | Ahmed Muzammil Jamal ] LinkedIn ] @ahmedmzl
  2. Whats inside Introducing JSON Why JSON JSON Structures Data in JSON JSON Arrays, Objects JSON Values, String, Number Tools for Developers JSON Data Example www.ahmedmzl.com | Ahmed Muzammil Jamal ] LinkedIn ] @ahmedmzl
  3. JavaScript Object NotationThe fat free alternative to XML www.ahmedmzl.com | Ahmed Muzammil Jamal ] LinkedIn ] @ahmedmzl
  4. Why JSON ??• Its easy for humans to read and write• Its also easy for computers to read and parse• JSONs structure is significantly simple.• Parsing efficiency is more when compared to XML• Lighter and faster than XML as on-the-wire data format www.ahmedmzl.com | Ahmed Muzammil Jamal ] LinkedIn ] @ahmedmzl
  5. JSON objects are "typed" vs. XML is "typeless" XML JSON All Strings boolean string array number www.ahmedmzl.com | Ahmed Muzammil Jamal ] LinkedIn ] @ahmedmzl
  6. JSON JavaScript Object Notation www.ahmedmzl.com | Ahmed Muzammil Jamal ] LinkedIn ] @ahmedmzl
  7. JSON ➡ Native data form for JavaScript • Data is readily accessible • XML data needs parsing as JSON objects • Needs to use tedious • Retrieving values from DOM APIs and JSON is as easy as processing power to importing an object in assign to variables JavaScript www.ahmedmzl.com | Ahmed Muzammil Jamal ] LinkedIn ] @ahmedmzl
  8. JSON is built on two structures• A collection of name/value pairs • Realization (as in various programming languages) • Object, Record, Struct, Dictionary, HashTable, Keyed List, or Associative Array• An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence. • Realization (as in various programming languages • array, vector, list, or sequence• JSON follows universal data structures • It is interoperable between programming languages www.ahmedmzl.com | Ahmed Muzammil Jamal ] LinkedIn ] @ahmedmzl
  9. Data Storage In JSON• Object• Array www.ahmedmzl.com | Ahmed Muzammil Jamal ] LinkedIn ] @ahmedmzl
  10. JSON :: Object• Example var myJSONObject = { “Fruits” : [ “Apple” , “Orange”, “Grapes” ], }; www.ahmedmzl.com | Ahmed Muzammil Jamal ] LinkedIn ] @ahmedmzl
  11. JSON :: Array• Example var myJSONArray = [ “Apple” , “Orange”, “Grapes” ]; www.ahmedmzl.com | Ahmed Muzammil Jamal ] LinkedIn ] @ahmedmzl
  12. JSON Values www.ahmedmzl.com | Ahmed Muzammil Jamal ] LinkedIn ] @ahmedmzl
  13. JSON String • A string is very much like a C or Java string. • string is a collection of zero or more Unicode characters within double quotes and using backslash escapes • character is represented as a single character stringEg.“Ahmed Muzammil”“”Jamal””“nTest”“uAF34u34DS” www.ahmedmzl.com | Ahmed Muzammil Jamal ] LinkedIn ] @ahmedmzl
  14. JSON Number• A number is very much like a C or Java number ! octal and hexadecimal formats are not used.Eg.12345671.324320.342 e+121.23324342 e-32 www.ahmedmzl.com | Ahmed Muzammil Jamal ] LinkedIn ] @ahmedmzl
  15. JSON Tools for Developers• Available for download @ www.json.org• Parser Parse JSON text files and convert these to a Java model• Renderer Render a Java representation into text• Serializer Serialize plain POJO clusters to a JSON representation• Validator Validate the contents of a JSON file using a JSON schema• Tools are also available for other languages • ASP, ActionScript, C Family, ColdFusion, Delphi, JavaScript, Perl, PHP, PL/SQL, Ruby, Symbian & many more www.ahmedmzl.com | Ahmed Muzammil Jamal ] LinkedIn ] @ahmedmzl
  16. Where is JSON Used?• Ajax applications / Web 2.0• Represent configuration information• Implement communication protocols• Data Exchange• Remote Procedure Call / RMI• Service Oriented Architecture www.ahmedmzl.com | Ahmed Muzammil Jamal ] LinkedIn ] @ahmedmzl
  17. Let’s end with an example JSON { "firstName": "John", "lastName": "Smith", "age": 25, "address": { "streetAddress": "21 2nd Street", "city": "New York", "state": "NY", "postalCode": "10021“ }, "phoneNumber": [ { "type": "home", "number": "212 555-1234“ }, { "type": "fax", "number": "646 555-4567“ } ] } www.ahmedmzl.com | Ahmed Muzammil Jamal ] LinkedIn ] @ahmedmzl
  18. The same Example in XML <Object> <Property><Key>firstName</Key> <String>John</String></Property> <Property><Key>lastName</Key> <String>Smith</String></Property> <Property><Key>age</Key> <Number>25</Number></Property> <Property><Key>address</Key> <Object> <Property><Key>streetAddress</Key> <String>21 2nd Street</String></Property> <Property><Key>city</Key> <String>New York</String></Property> <Property><Key>state</Key> <String>NY</String></Property> <Property><Key>postalCode</Key> <String>10021</String></Property> </Object> </Property> <Property><Key>phoneNumber</Key> <Array> <Object> <Property><Key>type</Key> <String>home</String></Property> <Property><Key>number</Key> <String>212 555-1234</String></Property></Object> <Object> <Property><Key>type</Key> <String>fax</String></Property> <Property><Key>number</ Key> <String>646 555-4567</String></Property> </Object> </Array> </Property> </Object> www.ahmedmzl.com | Ahmed Muzammil Jamal ] LinkedIn ] @ahmedmzl
  19. Want more of JSON ? Go here...• Introducing JSON - http://www.json.org/• Introduction to JSON - http://www.javapassion.com/ajax/JSON.pdf• JSON in JavaScript - http://www.json.org/js.html• JSON in Java - http://www.json.org/java/index.html www.ahmedmzl.com | Ahmed Muzammil Jamal ] LinkedIn ] @ahmedmzl
  20. JSON is GOOD !• Like this presentation? Share it...• Questions? - Tweet me @ahmedmzl• I can help you on: Buy a "I ♥ JSON Tshirt" like this here at zazzle.com • Service Oriented Architecture (SOA) • Business Process Management (BPM) • Business Intelligence (BI) • User Experience (UX) • Product Development • Project Management www.ahmedmzl.com | Ahmed Muzammil Jamal ] LinkedIn ] @ahmedmzl

×