Colander¶
Colander is useful as a system for validating and deserializing data obtained via XML, JSON, an HTML form post or any other equally simple data serialization. It is tested on Python 2.7, 3.5, 3.6, 3.7, 3.8, 3.9, and 3.10, and PyPy 2.7 and PyPy 3.8. Colander can be used to:
Define a data schema.
Deserialize a data structure composed of strings, mappings, and lists into an arbitrary Python structure after validating the data structure against a data schema.
Serialize an arbitrary Python structure to a data structure composed of strings, mappings, and lists.
Colander is a good basis for form generation systems, data description systems, and configuration systems.
Out of the box, Colander can serialize and deserialize various types of objects, including:
A mapping object (e.g. dictionary).
A variable-length sequence of objects (each object is of the same type).
A fixed-length tuple of objects (each object is of a different type).
A string or Unicode object.
An integer.
A float.
A decimal float.
A boolean.
An importable Python object (to a dotted Python object path).
A Python
datetime.datetime
object.A Python
datetime.date
object.A Python
enum.Enum
object.
Colander allows additional data structures to be serialized and deserialized by allowing a developer to define new "types".
The error messages used by Colander's default types are internationalizable.
- Colander Basics
- The Null and Drop Values
- Extending Colander
- Schema Binding
- Manipulating Data Structures
- Interfaces
- Colander API
- Glossary
- Change History
- 2.0 (2022-01-02)
- 1.8.3 (2020-11-28)
- 1.8.2 (2020-08-07)
- 1.8.1 (2020-08-06)
- 1.8.0 (2020-08-05)
- 1.7.0 (2019-02-01)
- 1.6.0 (2019-01-31)
- 1.5.1 (2018-09-10)
- 1.5.0 (2018-09-07)
- 1.4.0 (2017-07-31)
- 1.3.3 (2017-04-25)
- 1.3.2 (2017-01-31)
- 1.3.1 (2016-05-23)
- 1.3 (2016-05-23)
- 1.2 (2016-01-18)
- 1.1 (2016-01-15)
- 1.0 (2014-11-26)
- 1.0b1 (2013-09-01)
- 1.0a5 (2013-05-31)
- 1.0a4 (2013-05-21)
- 1.0a3 (2013-05-16)
- 1.0a2 (2013-01-30)
- 1.0a1 (2013-01-10)
- 0.9.9 (2012-09-24)
- 0.9.8 (2012-04-27)
- 0.9.7 (2012-03-20)
- 0.9.6 (2012-02-14)
- 0.9.5 (2012-01-13)
- 0.9.4 (2011-10-14)
- 0.9.3 (2011-06-23)
- 0.9.2 (2011-03-28)
- 0.9.1 (2010-12-02)
- 0.9 (2010-11-28)
- 0.8 (2010/09/08)
- 0.7.3 (2010/09/02)
- 0.7.2 (2010/08/30)
- 0.7.1 (2010/06/12)
- 0.7.0
- 0.6.2 (2010-05-08)
- 0.6.1 (2010-05-04)
- 0.6.0 (2010-05-02)
- 0.5.2 (2010-04-09)
- 0.5.1 (2010-04-02)
- 0.5 (2010-03-31)
- 0.4 (2010-03-30)
- 0.3 (2010-03-29)
- 0.2 (2010-03-23)
- 0.1 (2010-03-14)