10 March 2011

What is JSON ?

When you learning javascript or framework for javascript, you quite often see JSON in example here JSON in example.
You notice that, they are used as provide data for specified example and you feel quite screwed up, because you have no f...idea about server(or you just have no passion to install server and config because in most cases they Server which you hate it).It means that, you cannot receive data from server so you cannot using another ready-made example and only what you cand is .... screaming ... and then you ask yourself. What is JSON anyway ??

(All below information are copied (and lightly modified) from www.json.org and i put this here in case if above site is down)

JSON is acronym of JavaScript Object Notation.
It is a data-interchange format.
It is a text format that is completely language independent.(Which means it can be used in many languages,not javascript only or even in project when you don't use javascript at all)

For example between javascript and Java.

JSON is built on two structures:
A collection of name/value pairs.(In languages representation of this can be object, record, struct, dictionary, hash table, keyed list, or associative array.
An ordered list of values. (In languages representation of this can be array, vector or list).

Example of JSON forms which i usually want to use

object
single item: { string : value }
many items: { string : value , string : value , (...) , string : value }

array
single item: [ value ]
many items: [ value , value , (...) , value ]

possible values : string number object array true false null

char
any-Unicode-character
control-character
\" quotation mark
\\ character \
\/ character /
\b backspace
\f formfeed
\n newline
\r carriage return
\t tab
\u 4 hexadecimal digits


If you want to know everything about JSON (it takes whole ... 30 minutes and is translated to many languages) then go to this page:
http://www.json.org/

I will add note soon about "how to modify exists example in extjs that needed data from server to example to contain data stored in Ext itself".