One of the data types that you will most commonly work with when implementing Node.js web applications and services is JSON (JavaScript Object Notation). JSON is a very lightweight method to convert JavaScript objects into a string form and then back again. It works well when you need to serialize data objects when passing them from client to server, process to process, or stream to stream or when you’re storing them in a database.
There are several reasons to use JSON to serialize your JavaScript objects instead of using XML:
JSON is much more efficient and takes fewer characters.
Serializing/deserializing JSON is faster than serializing/deserializing XML.
JSON is easier to read from a developer’s perspective because its syntax is similar to that of JavaScript.
You might want to use XML instead of JSON for extremely complex objects or if you have XML/XSLT transforms already in place.