Compare XML JSON INIDG three formats

Source: Internet
Author: User
Tags cdata

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.