...
/Serializing Objects Using JSON
Serializing Objects Using JSON
Learn how to serialize objects using JSON methods.
We'll cover the following...
Overview
There are many formats that have been used for text-based data exchange over the years. Extensible Markup Language (XML) is popular, but the files tend to be large. Yet Another Markup Language (YAML) is another format that you may see referenced occasionally. Tabular data is frequently exchanged in the Comma-Separated Value (CSV) format. Many of these are fading into obscurity and there are many more that you will encounter over time. Python has solid standard or third-party libraries for all of them.
Before using such libraries on untrusted data, make sure to investigate security concerns with each of them. XML and YAML, for example, both have obscure features that, used maliciously, can allow arbitrary commands to be executed on the host machine. These features may not be turned off by default. Even something as simple-seeming as a ZIP file or a JPEG image can be hacked to create a data structure that can crash a web server.
JSON format
JavaScript Object Notation (JSON) is a human-readable format for exchanging data. JSON is a standard format that can be interpreted by a wide array of heterogeneous client systems. This means JSON is extremely useful for transmitting data between completely decoupled systems. The JSON format does not have any support for ...