Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

JSON

Java Script Object Notation


- JSON is a format for storing and transporting data.
- JSON is lightweight data interchange format.
- JSON is language independent
- Lightweight and used for transporting data so it is used when data is sent from
Server to any web page.
- It is simple to understand.

Use of JSON

1. XML alternative
2. Its light weitght
3. Less verbose ( More compact style, readable)
4. very Fast and Performance
5. Increasing Parsing speed
6. Its uses Map Data Structre instead of Tree like XML

JSON vs XML

1. Open data interchange 9 Server -. Client


2. Diffcult to parse
XML
1. Fetch an XML document
2. Use XML DOM to parse the XMl
3. Store in variable

JSON

1. fetch as JSON String


2. use JSON.Parse for JSON String

Syntax Rule

Similiar to JavaScript
Keys is in double Quotes

{ "name" : "john" , "age" :23 }

//Data should be in name/value pair


//data should be separated as Commas
//Curely braces holds the objects
//Squae brackets holds array

JSON Data Types

1. String
2. Number
3. JSON Object
4. Array
5. Boolean
6. Null

Incompatiable

1. Function
2. Date
3. undefined

Json Syntax Rules

1. Data is in Name/value Pairs


2. Data is separated by commas
3. JSON objects are surrounded by curly braces
4. Cruly braces hold objects
5. Square brackers hold arrays

You might also like