Breaking News
Home / ServerSide / JSON Sample

JSON Sample

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


    <name>Mr A</name>

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:

“name”:”Mr A”,

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

        <name>Mr A</name>
        <name>Mr B</name>

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

        {“name”:”Mr A”,
        {“name”:”Mr B”,
        ]    }

Some more example from

{“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”>
    <menuitem value=”New” onclick=”CreateNewDoc()” />
    <menuitem value=”Open” onclick=”OpenDoc()” />
    <menuitem value=”Close” onclick=”CloseDoc()” />


Check Also

What webservices standards are supported by Siebel Business Applications?

The following Web services standards are supported by Siebel Business Applications:     * Web Services …

Leave a Reply