Let's see how the data is encoded in JSON, for this consider that we have an entity called Customer, which has a name, age, country of residence and two telephone numbers. This information if represented in XML could look something like this:


<!><customer>
    <name>Mr A</name>
    <age><33/age>
    <country>USA</country>
    <tel>11111111</tel>
    <tel>99999999</tel>
 </customer>

Here name, age and country are represented as Name Value Pairs and tel is an Array of one or more than one telephone the customer has. This same information can be represented in JSON format as:

{"customer":{
"name":"Mr A",
"age":"33",
"country":"USA",
"tel":["111111111","9999999999"]
}}

If there were mutliple customers then it could have been represented as:

<customers>
    <customer>
        <name>Mr A</name>
        <age>33</age>
        <country>USA</country>
        <tel>11111111</tel>
        <tel>99999999</tel>
     </customer>
     <customer>
        <name>Mr B</name>
        <age>22</age>
        <country>USA</country>
        <tel>2222222222</tel>
        <tel>4444444444</tel>
     </customer>
 </customers>

Now here customers is a array(collection) of customer and can be represented in JSON as:

{"customers":
    {"customer":[
        {"name":"Mr A",
        "age":"33",
        "country":"USA",
        "tel":["111111111","9999999999"]},
        {"name":"Mr B",
        "age":"22",
        "country":"USA",
        "tel":["2222222222","44444444"]}
        ]
    }
}

Some more example from JSON.org

{"menu": {
  "id": "file",
  "value": "File",
  "popup": {
    "menuitem": [
      {"value": "New", "onclick": "CreateNewDoc()"},
      {"value": "Open", "onclick": "OpenDoc()"},
      {"value": "Close", "onclick": "CloseDoc()"}
    ]
  }
}}

The same text expressed as XML:

<menu id="file" value="File">
  <popup>
    <menuitem value="New" onclick="CreateNewDoc()" />
    <menuitem value="Open" onclick="OpenDoc()" />
    <menuitem value="Close" onclick="CloseDoc()" />
  </popup>
</menu>