JSON and XML

Let's start to learn important data formats, i.e., JSON and XML.

Handling XML and JSON Data

XML has been the go-to format and the only choice of programmers for open data interchange for a long time. Yet over recent years, JSON has also gained some popularity due to its lightweight nature and faster parsing. Regardless of these differences, they both have been adopted by all major programming languages of the world. In this chapter, we are going to dig deeper into how to read/parse, build XML and JSON formats, and will try to understand how serialization and deserialization work with these two formats.

Difference between JSON and XML

Generally speaking, JSON is a lightweight cousin of XML and there is no clear superiority of one format against the other. Our final choice should depend on what we need and our individual use case.

XML stands for Extensible Markup Language, which is an open-source language that is heavily used by programmers worldwide to store, persist, and transport structured data so that it can be read by other programs and softwares independent of the ...