Message can be written in both XML and JSON . There're examples of the same message("menu") in XML and JSON:
The 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>
The same text expressed as JSON:
{"menu": { "id": "file", "value": "File", "popup": { "menuitem": [ {"value": "New", "onclick": "CreateNewDoc()"}, {"value": "Open", "onclick": "OpenDoc()"}, {"value": "Close", "onclick": "CloseDoc()"} ] } }}
After learnt about XML, reading the above examples helped me understand JSON!
0 comments:
Post a Comment