JavaScript Object Notation (JSON)
While both SOAP and REST use XML for interchange, JavaScript Object Notation (JSON) uses a subset of JavaScript. This is illustrated in the figure below.
JavaScript Object Notation (JSON) uses name/value pairs. This is similar to the tags used by XML. An example from the figure below shows, at the left, the XML tag of “<state>” with the value of “MN.” The pairs for JSON are at the right. It similarly shows the name “state” is paired with the value “MN.” The name/value pairs do not need to be in a specific order. Also, like XML, JSON provides resiliance to changes and avoids the brittleness of fixed record formats. This applies to JSON as well.
JSON is an alternative to SOAP and Representational State Transfer (REST).
The following figure illustrates using JSON for Web Services.