JSON is the acronym for JavaScript Object Notation. is a lightweight data-interchange format.
It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the
JavaScript Programming Language, Standard ECMA-262 3rd Edition - December 1999.
☛
It is alternative to XML (as both are used for storing and exchanging data)
☛
JSON is language independent & text-based interchange format so work with JavaScript but only as a text container instead a
programming languages. JavaScript functions convert JSON data into JavaScript objects.
Requirements :-
☛
Basic knowledge of
HTML,
CSS, Javascript,
XML
before start study basics of these subjects first.
☛
Simple-text editor, such as Notepad, Editplus, Notepad++ is popular editor among web developers.
Download here
Basic JSON rules :-
☛
Always use double quotes after & before JSON texts as :-
"ColorName":"Green"
☛
It's case sensitive - say during creation of object as :-
"Math":"75%"
It is declared as obj.Math not obj.maTh
☛
Always use filename extension with .json.
☛
It's Media type is application/json.
Benifits of JSON :-
☛
It's human readable, used by lots of programming languages, can be fetched with an XMLHttpRequest, quicker to read and write,
can be used as a arrays,
lightweight data-interchange format, language independent, easy to understand.
☛
It can works with languages such as ASP, PHP, PERL, Ruby, Java, Python etc.
☛
You can use JSON as a manual database.
JSON Vs XML :-
☛
JASON have more benifits over XML as :-
JSON can use single and multiple arrays, JSON is easly to read and write as compare with XML,
JSON syntex is shorter, JSON only use { } or [ ] instead any tag,
JSON Example :-
☛
marks = '{"Math":"75%","English":"82%","History":"93%"}';