Click here to Skip to main content
15,884,739 members
Please Sign up or sign in to vote.
5.00/5 (2 votes)
See more:
Hello,

it is said that 'JSON is smaller than XML, and faster and easier to parse.'
I know that it is easier to parse. but how it is 'smaller' than xml? its length (data length) is similar to xml.

it it because
XML
"firstName":"John"
in json is equivalent to
XML
<firstname>John</firstname>
?
Just curious about it.
Posted
Updated 10-Jul-13 1:31am
v3

1 solution

"firstName":"John"
<firstname>John</firstname>
||||||||||||||||||123456789
123456789012345678

9 characters saved, in your example.
JSON: 18
xml: 27
overhead: 50%.

Mileage may vary... ;)

Pablo.
 
Share this answer
 
Comments
Amol_B 10-Jul-13 9:50am    
Thanks Pablo!
RaisKazi 10-Jul-13 9:58am    
Good Answer. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900