JSON – Introduction – Why use JSON ??



JSON – Introduction – Why use JSON ??

0 0


json


On Github kmathur7 / json

JSON

Introduction

What  is  JSON?

The  Father  of  JSON

Douglas Crockford

JSON  is  

A lightweight text based data-interchange format

Completely Independent Language

Based on subset of the Javascript Programming Language

Easy to understand, manipulate and generate

JSON  is   not

Overly Complex

A document format

A markup language

A programming language

Why use JSON ??

Straightforward syntax

Easy to create and manipulate

Supported by all major Javascript Frameworks

Supported by most backend technologies

JSON  vs  XML

Lighter and faster than XML

JSON uses typed Objects. All XML values are type-less strings

Less syntax, no semantics

Properties are immediately accessable in JavaScript Code

Syntax

JSON  object  Syntax

unordered sets of name/value pairs

Begins with { ( left brace )

Ends with } ( right brace )

Each name is followed by : ( colon )

Name/value pairs are separated by , ( comma )

Arrays  in  JSON

An ordered collection of values

Begins with [ ( left bracket )

Ends with ] ( right bracket )

Name/value pairs are separated by , ( comma )

JSON Useage

How  and  When  to  use  JSON

  • Transfer data to and from a server
  • Perform asynchronous datacalls without requiring a page refresh
  • Working with data stores
  • Compile and save form or user data for local storage