Xml,json may not be the best data transfer scheme, and CSV may be better suited

Source: Internet
Author: User
Tags json php and first row

When the data structure is simple enough for a two-dimensional table to describe the format,

The comma interval represents the column, \ r \ n represents the row, and the first row is the corresponding property name.

Like

ColName1, ColName2, ColName3

1, "title", "Http://ss.ss.com/ss"

2, "title", "Http://ss.ss.com/ss"

3, "title", "Http://ss.ss.com/ss"

In this way, remove the redundant attribute tags such as xml,json, reduce the bandwidth pressure!

Note: Attribute values cannot contain the ","! What would be better, more general, if it included what to do with it?

On the client side, you can provide a client language conversion tool as needed to easily convert text to Xml,json format.

Xml:

<rows>
<row>
<colName1>Colvalue1</colName1>
<colName2>Colvalue2</colName2>
<colName3>Colvalue3</colName3>
</row>
<row>
<colName1>Colvalue1</colName1>
<colName2>Colvalue2</colName2>
<colName3>Colvalue3</colName3>
</row>
</rows>

Json:

[{'colName1': Colvalue1,'colName2': Colvalue2},{'colName1': Colvalue1,'colName2': Colvalue2}]

This kind of parsing tool is easy to realize, it is javascript,actionscript,python,php and so on client to realize just separately!

==================================================================

To sum up the speeches of fellow brothers:

1, server object conversion to Csv,csv and then according to need or to do processing, increase programming work (if the bandwidth requirements, this part of the work is meaningful);

2, Xml,json is a more widely accepted standard (before Xml,json, pipe character segmentation, comma-separated data format is also very common)

3, CSV transmission needs to consider the encoding format (Xml,json is also text, also requires format specified)

4, \ r \ n, or \ r problem, unified designated as \ r \ n, there should be no problems, there will be Php,pyhon can be tested;

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.