ForHosting KIT · Data & Files

Flatten nested JSON to table with dot-notation keys

Turn a nested JSON object or array into a simple sequence of key/value rows without writing a one-off traversal script.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

Every nested property receives a dot-notation path, and array positions become numeric path segments, so values such as an order identifier can be addressed consistently as orders.0.id. The result is convenient for spreadsheet rows, database staging tables, logs, mapping tools, and any workflow that needs predictable paths instead of nested structures. Processing is deterministic, preserves JSON value types, and rejects malformed JSON or a scalar root with a clear input error.

Convert nested structure into predictable paths

Nested JSON is ideal for APIs because it keeps related values together, but many reporting and import tools expect a flat sequence of fields. This capability walks every object property and array element, joining each segment with a dot. A value stored under a customer object and then a name property becomes customer.name. The first element of an orders array is addressed through orders.0, so its identifier becomes orders.0.id. Each leaf is returned as a row with a key and a value, which makes the output straightforward to display, filter, or transform into columns. Traversal follows the order present in the parsed JSON, providing stable results for the same input. Strings remain strings, numbers remain numbers, booleans remain booleans, and null remains null. Empty objects and empty arrays are emitted as values rather than silently disappearing, so the flattened output still records that those paths existed in the source document.

Prepare input and interpret the output

Provide the complete JSON document in the json field as text. Its root must be either an object or an array. This requirement avoids an ambiguous empty key for standalone strings, numbers, booleans, or null. Object property names are used exactly as supplied, while array indexes are written as zero-based numeric segments. The response contains pairs, an array whose entries have key and value fields and can therefore be treated directly as table rows. If the root itself is an empty object or array, the returned key is an empty string and the value preserves that empty container. Be aware that dots already present inside an original property name are not escaped. For example, a literal property named user.name produces the same visible path as a nested user object containing name. If your data uses dotted property names and path identity must be reversible, rename those properties before flattening or retain the original JSON alongside the flattened result.

Use flat pairs in data workflows

The flattened pairs work well as an intermediate representation. A spreadsheet automation can place keys in one column and values in another; an ingestion job can pivot selected paths into a wide table row; and a comparison tool can index pairs by key before checking two documents. Numeric array segments also make repeated records explicit instead of merging values from different elements. Because the operation performs no network requests and uses no random values, timestamps, or model inference, identical JSON text produces identical output every time. Invalid JSON fails rather than returning a partial result, and valid scalar JSON fails because it does not meet the object-or-array contract. The API price is $0.002 per item, while the browser runner can execute the same deterministic logic locally. For very large documents, consider whether a streaming or schema-specific pipeline is more appropriate, since flattening necessarily creates one output row for every primitive leaf or empty container in the entire document.

Prepare an API response for a table

Turn nested response fields into explicit paths that can be selected, mapped, or shown as key/value rows.

Build import mappings

Inspect dot-notation paths before mapping selected JSON values into spreadsheet or database columns.

Compare structured records

Flatten two objects into stable path/value sequences so differences can be located by their full paths.

What does it cost?

Each API item costs $0.002. The browser runner can process the input locally for free.

How are arrays represented?

Array positions become zero-based numeric path segments, such as orders.0.id and orders.1.id.

Are JSON value types preserved?

Yes. Strings, numbers, booleans, null, and empty containers retain their JSON types in the value field.

What happens to empty objects and arrays?

They are returned as leaf values so their paths are not lost. An empty root container uses an empty key.

Can I submit a JSON string or number as the root?

No. The parsed root must be an object or array; scalar roots return an invalid input error.

Are dots in original property names escaped?

No. Property names are preserved exactly, so rename dotted properties first if paths must be reversible without ambiguity.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/data/flatten-nested-json

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/data/flatten-nested-json \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"json":"{\"customer\":{\"name\":\"Ada\",\"address\":{\"city\":\"London\"}},\"orders\":[{\"id\":7,\"paid\":true}]}"}'
{
  "json": "{\"customer\":{\"name\":\"Ada\",\"address\":{\"city\":\"London\"}},\"orders\":[{\"id\":7,\"paid\":true}]}"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "data.flatten_nested_json",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_mb25
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Read the full KIT documentation →