Now that mobile terminals are emerging, interfaces must be used to transmit data for them in many places. Is it better to use xml or json? I personally think using json is a good choice. I will analyze from the following points: currently, mobile terminals are emerging, and interfaces must be used to transmit data for them in many places. Is it better to use xml or json? I personally think using json is a good choice. I will analyze the following points:
1. xml tags must be written in pairs, such
XXXXXX, while the json format is {"name": "XXX", "name": "XXX "},
Therefore, json significantly saves the transmission capacity.
2. json generation and data parsing are relatively simple. Taking php as an example, you only need to use a json_encode function to convert an array into json data, but the xml generation process is a little more troublesome.
3. json extension is more convenient, and the resolution speed is faster.
Therefore, there are no special rules in the project, so it is better to use json.
The above is the content that the interface returns data in xml or json. For more information, see PHP Chinese Network (www.php1.cn )!