JavaScript Object Notation (JSON)

JSON is a light-weight syntax language that provides similar functionality to XML.

There are several differences between JSON and XML that are important. First, there is no concept of a namespace or attributes in JSON. Some argue that this makes JSON much simpler, while others argue that these are important features that render JSON less useful than XML.

Another important feature of JSON is that the syntax is defined by JavaScript and, as such, is is readily parsed by any JavaScript application. That said, there are security risks associated with the immediate consumption of JSON documents and, as such, secure systems will employ parsers, not unlike those used to parse XML.

Some argue that JSON produces smaller documents than XML and is more suitable for transmission over a network. Size can be greatly reduced in some instances, but it has also been shown that one can often re-write XML files to achieve the same effect.

While the foregoing may sound like an argument against JSON, it was not intended to be. JSON is merely another tool in the toolbox and, like all tools, one should pick the best tool for the job. In some cases, JSON is that better tool.

Below is an example of JSON document that shows an IP address and an associated ISO country code:

   "IPAddress" : { 
      "address" : "",
      "country" : "US"

It is interesting to note that the same example is shown in XML on the Techabulary entry for XML. The XML example requires 121 octets to represent, whereas the JSON version requires 85 octets.

Resources:, RFC 4627