Java – XML vs JSON. Which is better for storing small pieces of data?

See English answers > What are the pros and cons of XML and JSON? [closed] 17. I want to store some small pieces of data and do not want to use any database. We have two options: XML and JSON. Now anyone can suggest which one I should choose from the perspective of performance and architecture

1. Which is better? XML or JSON for storing data?

2. What are the advantages and disadvantages of JSON and XML?

Any help would be appreciated

edit

We don't use any web services. Our application is an independent application. We want to use XML or JSON to store some local data that will be used in the application. Data is like the details of questions and answers, static user details, etc

resolvent:

Remember, if the tag is longer than the data, JSON will only be smaller. Maybe in fact, XML is easier to read and JSON takes less space

XML professionals

>Easier to read > much more than JSON > one of the major industry standards > versioning > namespace support > multiple elements with the same name > validation

XML disadvantages

>Take up more space > increase bandwidth due to size

JSON professionals

>Don't take up a lot of space > use less bandwidth due to size (floor area) > rise in the ranks as one of the main industry standards

JSON disadvantages

>Harder to read > versioning destroys client / data

If you send more data than tags, they are roughly the same. You can better use XML to achieve fast parsing speed. I also think people expect slow mobile loading time and short application running time, so please try to parse in a slower format to slow down the application time

Finally, I say JSON, a small footprint will accelerate the transaction between your application and the web service you are trying to send / receive data

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>