Manipulating Data Structures
Colander schemas have some utility functions which can be used to manipulate an :term:`appstruct` or a :term:`cstruct`. Nested data structures can be flattened into a single dictionary or a single flattened dictionary can be used to produce a nested data structure. Values of particular nodes can also be set or retrieved based on a flattened path spec.
Flattening a Data Structure
:meth:`colander.SchemaNode.flatten` can be used to convert a datastructure with nested dictionaries and/or lists into a single flattened dictionary where each key in the dictionary is a dotted name path to the node in the nested structure.
Consider the following schema:
Consider also a particular serialization of data using that schema:
This data can be flattened:
The resulting flattened structure would look like this:
The process can be reversed using :meth:`colandar.SchemaNode.unflatten`: