Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

XML vs JSON

XML vs JSON

Both can be used to receive data from a web server


✘ Example: ‘employees’ object, array of 3 employees:
XML vs JSON

Similarities Differences
✘ Self-describing (human- ✘ JSON does not use end tag
readable) ✘ JSON is shorter
✘ Hierarchical ✘ JSON is quicker to read
✘ Can be parsed and used and write
by many programming ✘ JSON can use arrays
languages ✘ XML parsing – XML parser
✘ Both can be fetched by an ✘ JSON parsing – standard
XMLHttpRequest JavaScript function
JSON > XML

✘ JSON is easier to parse than XML


✘ JSON is parsed into a ready-to-use JavaScript
object

You might also like