JSON flatten
Flatten nested JSON into one level of dotted keys such as "user.address.city".
Input
Result
Fill in the input and press Run.
Your input is processed in memory and then discarded. It is not stored or logged. Even so, don't paste live passwords or keys into any online tool.
Use it from code or an agent
curl -s https://setget.net/v1/tools/json-flatten \
-H 'Content-Type: application/json' \
-d '{"input":{"text":"{\"user\":{\"name\":\"Sam\",\"tags\":[\"a\",\"b\"]}}","indent":0}}'
import json, urllib.request
body = {'input': {'text': '{"user":{"name":"Sam","tags":["a","b"]}}', 'indent': 0}}
request = urllib.request.Request("https://setget.net/v1/tools/json-flatten", json.dumps(body).encode(),
{"Content-Type": "application/json"})
print(json.load(urllib.request.urlopen(request))["result"])
const response = await fetch("https://setget.net/v1/tools/json-flatten", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({"input":{"text":"{\"user\":{\"name\":\"Sam\",\"tags\":[\"a\",\"b\"]}}","indent":0}}),
});
console.log((await response.json()).result);
Tool: run_tool
Arguments:
{
"slug": "json-flatten",
"input": {
"text": "{\"user\":{\"name\":\"Sam\",\"tags\":[\"a\",\"b\"]}}",
"indent": 0
}
}
{
"input": {
"text": "{\"user\":{\"name\":\"Sam\",\"tags\":[\"a\",\"b\"]}}",
"indent": 0
}
}
Endpoint: POST /v1/tools/json-flatten. Over MCP: run_tool with slug: "json-flatten".
Machine-readable: input schema, Markdown. Connect an agent.
Inputs
| Name | Type | Required | What it does |
|---|---|---|---|
text |
string | yes | The JSON to flatten. |
separator |
string | no | Text placed between key parts. Default: ".". |
indent |
integer | no | Spaces per level. 0 gives one compact line. Default: 2. From 0 to 8. |
Example
Input
{
"text": "{\"user\":{\"name\":\"Sam\",\"tags\":[\"a\",\"b\"]}}",
"indent": 0
}Result
{
"text": "{\"user.name\":\"Sam\",\"user.tags.0\":\"a\",\"user.tags.1\":\"b\"}",
"keys": 3
}Related tools
- JSON unflattenRebuild nested JSON from flat dotted keys. Numeric key parts become array positions.
json-unflatten - JSON to CSVTurn a JSON array of objects into CSV. Nested objects become dotted column names.
json-to-csv - JSONPath queryPull values out of JSON with a JSONPath expression such as $.items[*].name.
jsonpath-query - .env to JSONParse a .env file into a JSON object, handling quotes, comments and "export" prefixes.
env-to-json - CSV profilerSummarise each CSV column: type, blanks, distinct values, min, max, mean and top values.
csv-profile - CSV sort, filter and dedupeSort CSV by a column, keep rows containing some text, pick columns and remove duplicate rows.
csv-sort-filter-dedupe