Data nesting and data unnesting are the paired processes of transforming data between a flat, relational structure and a hierarchical, nested one. Nesting composes fields into structured, multi-level records, while unnesting expands those nested structures back into flat rows. Together they are the inverse of data flattening and unflattening.
## What is data nesting and data unnesting
Data nesting and data unnesting is the opposite of data flattening and data unflattening. In order to nest data from a "flattened" form such as a relational model, you need extra information about how to nest. When you unnest, you lose information.