When I first approached Windows Programming, I used the. ini file generally.
Later, they all define the data format and realize the data reading and writing.
Later, it was XML, then I was more accustomed to using TinyXML.
What now? Everyone is using JSON.
In pursuit of performance, many people have turned their eyes to Protobuf and Flatbuffer.
The change in the IT industry is so fast. As an IT practitioner, this piece of information is important.
The antique will not mention, let the archaeologists go deep dig it. This article discusses a good summary of Xml,json and Protobuf,stackoverflow.
Json
. Human readable/editable
. Can is parsed without knowing schema in advance
. Excellent browser support
. Less verbose than XML
Xml
. Human readable/editable
Can is parsed without knowing schema in advance
Standard for SOAP etc-------------?
Good tooling support
Pretty verbose
Protobuf
. Very dense data
. Hard-to-robustly decode without knowing the schema (data format is internally ambiguous, and needs schema to clarify)
. Very fast processing
. Not intended for human eyes (dense binary)
All has good support on the most platforms.
Personally, I rarely use XML these days. If the consumer is a browser or a public API I tend to use JSON. For internal APIs I tend to use protobuf for performance.
The personal view is that:
1. The structure relative to Xml,json is more closely related to "object-oriented" programming. JSON is more concise and conveys the same meaning, with fewer bytes in JSON, less content to transmit, and relatively faster.
2. Why use Protobuf? What are the advantages of relative JSON?
The protobuf is in binary form, with bytes taking up less and faster. Simultaneous PROTOBUF supports multiple programming languages for easy data exchange and version compatibility
Comparison of several common structured data