XML vs JSON. Which one is better for storing small chunk of data?
android, database, java, json, xml
Solution
Please keep in mind that JSON is only smaller if the tags are longer than the data. Probably the fact that the XML is a lot easier to read, and that JSON has a smaller footprint.
XML Pros
- Easier to read
- Used a lot more than JSON
- One of the main industry standards
- Versioning possible
- Namespace support
- Multiple elements with the same name
- Validation
XML Cons
- Takes up more space
- Increased bandwidth because of the size
JSON Pros
- Doesn't take up a lot of space
- Uses less bandwidth because of it's size (footprint)
- Rising in the ranks as one of the main industry standards
JSON Cons
- Harder to read
- Versioning breaks client/data
If you are sending more data than you send tags then they are about the same and you would have been better off using XML for the fast parsing speeds. I would also argue that people expect slow mobile load times and fast app running times so try and not slow down the app time by using a slower format to parse.
Finally I say JSON, The small footprint will speed up transactions between your app and the web services you're trying to send/receive data to/from.
Problem
I want to store some small chunk of data and don't want to go for any database, we have two choices `XML` and `JSON`, now anyone can please suggest which one should I select from performance and architecture point of view. 1. which is better to use? XML or JSON for storing data? 2. What are the pros and cons for both JSON and XML? any help would be greatly appreciated. EDIT We are not using any web service, our application is a stand alone app. We want to use XML or JSON for storing some local data which will be used in the application. The data would be like details of questions and answers, static userdetails etc.