Your SlideShare is downloading. ×
  • Like
An Introduction to JSON JavaScript Object Notation
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

An Introduction to JSON JavaScript Object Notation

  • 2,298 views
Published

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 …

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
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
2,298
On SlideShare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
55
Comments
2
Likes
4

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 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