AJAX Pattern: JSON Message
 |
Messages between browser and server contain JSON formatted data.
Frequency of use:
high
|
|
 |
JSON (JavaScript
Object Notation) is a
data exchange format that is lightweight and simple (the entire set of rules can be described
on a single page). JSON is not restricted to JavaScript and is easily parsed and generated
in any other programming language. It has a familiar and intuitive structure and
as a representation format it works well for a large category of problems.
JSON is used very frequently by AJAX developers.
Proponents of JSON like to say that JSON is 'like XML but without the fat'.
In this example, customer records are retrieved from a backend
database server. The records are filtered by total number of orders: any #,
over 10, over 25, and over 50. The server returns a message with
JSON formatted customer records that are readily parsed and displayed
by Javascript on the browser.
Example: View Customer List
Customers filtered by # of Orders
Click here to view the source code.