JSON versus XML
We'll go into detail on implementing both JSON and XML data in this chapter, but first, we should look at why you may choose one over the other. At their core, both JSON and XML are external text-based formats that you can use to store various types of data.
The key differences you should evaluate are:
- Ease of implementation: How easy is the format to implement into a code base?
- Readability: How easy is it to read? Can a nonprogrammer understand it quickly?
- Efficiency: How much can the file be compressed?
On the first hand, JSON is slightly easier to implement. JSON data is parsed and turned into Haxe dynamic objects. XML uses the Fast
class to pull out data as needed, which is still pretty easy, but does require a bit of extra effort.
On the other hand, XML is generally easier for nonprogrammers to read because you can add comments to describe the use of each property. JSON looks a bit closer to code, so programmers generally don't have problems with it. Since XML...