JSON: Difference between revisions

The educational technology and digital learning wiki
Jump to navigation Jump to search
 
Line 1: Line 1:
== Definition ==
== Definition ==


{{quotation | JSON (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. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These properties make JSON an ideal data-interchange language.}} ([http://www.json.org/ JSON], retrieved 19:06, 15 May 2007 (MEST)).
{{quotation | JSON (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. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These properties make JSON an ideal data-interchange language.}} ([http://www.json.org/ JSON], retrieved 19:07, 15 May 2007 (MEST)).


{{quotation | '''JSON''' (JavaScript Object Notation) is a lightweight computer data interchange format. It is a text-based, human-readable format for representing objects and other data structures and is mainly used to transmit such structured data over a network connection (in a process called serialization). JSON finds its main application in [[Ajax]] web application programming, as a simple alternative to using XML for asynchronously transmitting structured information between client and server. ([http://en.wikipedia.org/wiki/JSON], retrieved 19:06, 15 May 2007 (MEST))
{{quotation | '''JSON''' (JavaScript Object Notation) is a lightweight computer data interchange format. It is a text-based, human-readable format for representing objects and other data structures and is mainly used to transmit such structured data over a network connection (in a process called serialization). JSON finds its main application in [[AJAX]] web application programming, as a simple alternative to using XML for asynchronously transmitting structured information between client and server.}} ([http://en.wikipedia.org/wiki/JSON], retrieved 19:07, 15 May 2007 (MEST))


== Technology ==
== Technology ==
Line 9: Line 9:
* JSON is one of the rare modern data-interchange formats that is '''not''' XML.
* JSON is one of the rare modern data-interchange formats that is '''not''' XML.


From the JSON website, , retrieved 19:06, 15 May 2007 (MEST):
From the JSON website, , retrieved 19:07, 15 May 2007 (MEST):


{{quotationbox | JSON is built on two structures:
JSON is built on two structures:
* A collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array.
* A collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array.
* An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence.
* An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence.
Line 29: Line 29:


   myJSONObject.bindings[0].method    // "newURI"
   myJSONObject.bindings[0].method    // "newURI"
}}


== Links ==
== Links ==

Revision as of 19:07, 15 May 2007

Definition

“JSON (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. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These properties make JSON an ideal data-interchange language.” (JSON, retrieved 19:07, 15 May 2007 (MEST)).

JSON (JavaScript Object Notation) is a lightweight computer data interchange format. It is a text-based, human-readable format for representing objects and other data structures and is mainly used to transmit such structured data over a network connection (in a process called serialization). JSON finds its main application in AJAX web application programming, as a simple alternative to using XML for asynchronously transmitting structured information between client and server.” ([1], retrieved 19:07, 15 May 2007 (MEST))

Technology

  • JSON is one of the rare modern data-interchange formats that is not XML.

From the JSON website, , retrieved 19:07, 15 May 2007 (MEST):

JSON is built on two structures:

  • A collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array.
  • An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence.

JSON is a subset of the object literal notation of JavaScript. Since JSON is a subset of JavaScript, it can be used in the language with no muss or fuss.

var myJSONObject = {"bindings": [
       {"ircEvent": "PRIVMSG", "method": "newURI", "regex": "^http://.*"},
       {"ircEvent": "PRIVMSG", "method": "deleteURI", "regex": "^delete.*"},
       {"ircEvent": "PRIVMSG", "method": "randomURI", "regex": "^random.*"}
   ]
};

In this example, an object is created containing a single member "bindings", which contains an array containing three objects, each containing "ircEvent", "method", and "regex" members.

Members can be retrieved using dot or subscript operators.

 myJSONObject.bindings[0].method    // "newURI"

Links

Official
Tutorials and Overviews