In Mobile and web development, there is no need to avoid server-to-client data exchange, and it is necessary to find a suitable
Mainly consider two points, small data volume, fast parsing, support tools Rich
JSON (JavaScript Object Notation)
Network data exchange for Web and mobile applications in general
Advantages:
Can be parsed by JS native
Widely used for data interchange processing, developed for web and mobile applications, so the server and client are generally required to support JSON at the same time
Small amount of data, easy to parse, because the format is simple, only arrays, objects and plain text
Disadvantages:
Poor readability of the human eye,
Character types are easily confused with numeric types
Example
["Str1", 2,{"key": "Value}"
XML (extensible Markup Language)
Be widely used, with perfect standards
Advantages:
Good extensibility, free definition of tags
Widely used (Html,soap, application of the interface layout structure such as Android)
Descriptive, with section name, attribute name, and file header (description character encoding and version)
Nesting support
Support Comments <!---->
Supports special formats, cdata,<! [cdata[text content]]>
Disadvantages:
The amount of data is large, the most repeated information, because the nested nodes must have a head and tail, each node must have a key attribute value,...
Parsing is the most complex because the format itself is complex and has multiple types of nodes
Example
<?xml encoding= "Utf-8" version= "1.0" >
<!--for CLASS5 grade1-->
<class>
<student name= "Ming" age= ">"
<! [Cdata[some script]]>
</student>
</class>
INI (Initial)
More early use, typically used for storage system and application configuration information
Advantages:
So the amount of data is small because the format is the simplest
Parsing is the simplest, as long as parsing [],=, line wrapping
Support annotations;
Disadvantages:
INI only supports key-value mode, and only one-layer classification, no nesting
K1=k2
[SEC1]
K1=v1
K2=v2
[SEC2]
K1=v1