Python Module - jsonschema Part 3
This post is part of a series on the Python module - jsonschema:
In Part 2 of the Python Module - jsonschema, we covered the complex usage of types like number
, string
, array
, and object
. However, most examples focused on validating individual data types, while in practice, JSON data can often involve a mixture of multiple data types. For example, an array
might contain object
elements, and an object
might include nested objects
. Consider the following JSON data:
[
{
"user_id": 1,
"preference": {
"cooking": True,
"fishing": False,
}
},
{
"user_id": 1,
"preference": {
"cooking": True,
"fishing": False,
}
},
]
This section will introduce how to write JSON Schemas that are more practical for real-world use and easier to maintain.
Posted on Mar 28, 2018 in Python Module/Package Recommendations by Amo Chen ‐ 4 min read