# Flatten All ## Overview The Flatten All transformation flattens an entire JSON document into a single level structure. It handles both nested objects and arrays, using a specified delimiter to separate nested levels in the resulting keys. ## Configuration ```json { "operation": "flatten-all", "arguments": { "delimiter": "_" } } ``` ### Arguments | Name | Type | Required | Default | Description | | --------- | ------ | -------- | ------- | ------------------------------------------------------------- | | delimiter | string | false | "_" | Character(s) used to separate nested levels in flattened keys | ## Examples ### Basic Object Flattening Input: ```json { "name": "John", "address": { "street": "123 Main St", "city": "New York", "zipcode": "10001" } } ``` Output with `delimiter: "_"`: ```json { "name": "John", "address_street": "123 Main St", "address_city": "New York", "address_zipcode": "10001" } ``` ### Array Flattening Input: ```json { "name": "John", "contacts": [ {"type": "email", "value": "john@example.com"}, {"type": "phone", "value": "555-1234"} ] } ``` Output with `delimiter: "_"`: ```json { "name": "John", "contacts_0_type": "email", "contacts_0_value": "john@example.com", "contacts_1_type": "phone", "contacts_1_value": "555-1234" } ``` ## API To create a Flatten All transform via the API: ```bash curl -X 'POST' \ '{base_url}/api/v1/{org_id}/transforms' \ -H 'accept: application/json' \ -H 'x-api-key: {api_key}' \ -H 'Content-Type: application/json' \ -d '{ "config": { "operations": [ { "operation": "flatten-all", "arguments": { "delimiter": "_" } } ] }, "description": "Flatten entire JSON document", "name": "flatten_all_transform" }' ``` ## Notes 1. The transformation flattens all nested structures in the document 2. Array indices are zero-based in the flattened output 3. Primitive values (strings, numbers, booleans) are left unchanged 4. Null values are preserved in the flattened output 5. Delimiter defaults to "_"