xml vs json documents

xml and json are both document files we use to store data and transfer data from places to places. For example, imagine A and B are two entities. A wants to share some data with B, A can give B the data either in xml or json files. The data doesn’t have to be in files, it could also be in memory. A creates the data(xml/json) in memory and sends the data to B. xml is a variation of html, the format is pretty much the same as html. Whereas the format of json file is the format of an object in javascript, and it stands for javascript object notation.

Here is a data about a person represented in xml and json, they could be in a file or in memory.

xml

<person>
  <name>Milanie</name>
  <age>25</age>
  <address>
    <city>Miami</city>
    <postalCode>33101</postalCode>
  </address>
  <phones>
    <phone type="home">786-888-1234</phone>
    <phone type="mobile">305-888-1234</phone>
  </phones>
</person>

html

{
"name": "Milanie",
"age": 25,
"address": {
    "city": "Miami",
    "postalCode": "33101"
},
"phones": [
    {"phone": "786-888-1234", "type": "home"},
    {"phone": "305-888-1234", "type": "mobile"}
]
}

Search within Codexpedia

Custom Search

Search the entire web

Custom Search