Skip to content

JSON Format Overview

July 23, 2010

JSON is a very simple text format based on JavaScript’s object notation. The notation contains these basic elements:

* Objects. Objects begin and end with curly braces ({}).
* Object members. Members consist of strings and values, separated by colon (:). Members are separated by commas.
* Arrays. Arrays begin and end with braces and contain values. Values are separated by commas.
* Values. A value can be a string, a number, an object, an array, or the literals true, false, or null.
* Strings. Strings are surrounded by double quotes and contain Unicode characters or common backslash escapes.

A simple example of JSON output looks like this:

“Image”: {
“Title”:”View from 15th Floor”,
“Height”: 125,
“Width”: “100”
“IDs”:[ 116, 943, 234, 38793 ]

In this example, Image is a top-level object; all other data is a member of that object. Width, Height and Title are all simple members containing number and string data. Thumbnail is a nested object, containing members for URL, Height and Width. IDs is an array, containing number values. Note the string value for URL, in which the slashes are escaped (“\/”).


From → Programming

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: