November 26, 2008

Javascript object notation (JSON) is a data interchange format that utilizes a subset of Javascript that can be interpret by most popular programming languages today.  JSON.org provides a good description of the strengths of the format:

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.

In OWS, JSON weaved throughout the product.

  1. Configuration file format:
    OWS configurations are stored as JSON data structures.  This makes it possible to easy store and ready hierarchical actions, as well as make small configuration file edits by hand if ever the need arises. Finally, we have found that storing configurations in JSON constitutes a 30% savings over our previous XML file format due to the efficiency of the format.
  2. Data Source:
    The most popular place from which to pull data is obviously a database.  OWS also support the ability to make an HTTP request to a webpage that return JSON and convert this into a dataset that can be rendered using an OWS template or a subquery.  As a result, OWS can be used an a module engine for Yahoo! Pipes as well pull data from other sources of information of the web.
  3. The Ribbon control has much of its configuration information stored in JSON format.
  4. The querybuilding communicates with the OWS server component via a JSON message format.

JSON is an incredibly power way to store and exchange information.

JSON Structure

The following is an extended quotation from the JSON.org site on the format structure of JSON.

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.

These are universal data structures. Virtually all modern programming languages support them in one form or another. It makes sense that a data format that is interchangable with programming languages also be based on these structures.

In JSON, they take on these forms:

An object is an unordered set of name/value pairs. An object begins with { (left brace) and ends with } (right brace). Each name is followed by : (colon) and the name/value pairs are separated by , (comma).

An array is an ordered collection of values. An array begins with [ (left bracket) and ends with ] (right bracket). Values are separated by , (comma).

A value can be a string in double quotes, or a number, or true or false or null, or an object or an array. These structures can be nested.

A string is a collection of zero or more Unicode characters, wrapped in double quotes, using backslash escapes. A character is represented as a single character string. A string is very much like a C or Java string.

A number is very much like a C or Java number, except that the octal and hexadecimal formats are not used.

Whitespace can be inserted between any pair of tokens. Excepting a few encoding details, that completely describes the language.

Average (0 Ratings):
Want to help out?

New York, NY • Baltimore, MD • Vienna, VA • St. Louis, MO • Seattle, WA • info@openwebstudio.com

Bookmark & Share Bookmark and Share