Xerobit

JSON to Array Converter

Use this json to array tool to convert any JSON text into a structured array of entries showing the path, key, value and type for every element. Objects become arrays of key-value pairs, nested structures are flattened with dot-notation paths, and all processing runs locally in your browser without uploading data.

Paste valid JSON. Objects, arrays, strings, numbers, booleans and null are all supported.

Flat entries list every leaf with its full path. Nested arrays preserve the original structure using only arrays.

Result

[
  [
    "name",
    "Ada"
  ],
  [
    "age",
    36
  ]
]

How to use the json to array converter

  1. Paste your JSON text into the JSON input field.
  2. Choose an output mode: Flat entries lists every value with its path, while Nested arrays converts objects into arrays of key-value pairs.
  3. The result updates automatically as you type or change the mode.
  4. Copy the output array for use in your code or pipeline.

How the json to array conversion works

The tool uses JSON.parse to read the input, then walks the resulting value recursively. In flat entries mode, every primitive (string, number, boolean, null) is recorded with its full dot-notation path. For example, the JSON {"user":{"id":1}} becomes [["user.id", 1]]. Arrays that contain only primitives are kept as-is, while arrays containing objects are expanded so each object's keys are prefixed with the array index.

In nested mode, every JSON object is replaced by an array of two-element arrays representing its key-value pairs, preserving the original hierarchy. The key order follows the order returned by Object.keys(), which matches insertion order for string keys in modern engines.

Example conversions

This table shows how common JSON shapes look after a json to array conversion in both modes.

JSON inputFlat entriesNested arrays
{"a":1}[["a", 1]][["a", 1]]
[1,2][1, 2][1, 2]
{"x":{"y":2}}[["x.y", 2]][["x", [["y", 2]]]]
nullnullnull

Handling edge cases

Several JSON features require careful handling during conversion. An empty root object ({}) produces an empty array ([]), while an empty object nested inside another keeps its place as a pair such as ["a", {}] in flat mode. Unicode characters, including emoji encoded as surrogate pairs, survive the round-trip because JSON.parse decodes them correctly before the tool processes the value.

If the root value is a primitive such as a bare string, number, boolean or null, the output is simply that primitive since there is no structure to convert. Invalid JSON triggers a clear error message that includes the exact text from the parser, making it easy to spot missing quotes, trailing commas or other syntax issues.

When to use this format

Converting JSON to an array representation is useful when feeding data into systems that expect positional rather than named fields. Flat entry lists work well for building lookup tables, generating configuration rows or preparing data for tools like json to html table or json to markdown table.

Nested arrays are helpful when you need to serialize a structure into a format that lacks native object support, or when passing data through pipelines that treat everything as sequences. If you later need language-specific types, sibling converters such as json to go struct or json to c# class handle that step.

Performance and limits

Because the entire process relies on the built-in JSON.parse and a recursive walk, performance is limited mainly by the size of the input. Browsers comfortably handle inputs of several megabytes. Very deep nesting (thousands of levels) may hit the engine's call-stack limit; in practice, typical API responses and configuration files stay well within safe bounds.

All computation happens locally. Nothing is sent over the network, so sensitive data stays in your browser session.

Worked examples

ExampleInputResult
Simple objectJSON input: {"name": "Ada", "age": 36}; Output mode: entries[ / [ / "name", / "Ada" / ], / [ / "age", / 36 / ] / ]
Nested objectJSON input: {"user": {"id": 1, "tags": ["admin", "dev"]}}; Output mode: entries[ / [ / "user.id", / 1 / ], / [ / "user.tags", / [ / "admin", / "dev" / ] / ] / ]
Array of objectsJSON input: [{"a": 1}, {"b": 2}]; Output mode: entries[ / [ / "0.a", / 1 / ], / [ / "1.b", / 2 / ] / ]
Nested modeJSON input: {"x": 10, "y": [true, null]}; Output mode: nested[ / [ / "x", / 10 / ], / [ / "y", / [ / true, / null / ] / ] / ]

FAQ

What does converting json to array actually do?

It transforms JSON objects into arrays of key-value pairs and optionally flattens nested structures so every value has a clear path. Arrays of primitives remain unchanged.

Does it handle nested JSON objects?

Yes. In flat mode, nested keys are joined with dots (for example, "user.address.city"). In nested mode, each level becomes an array of pairs inside its parent.

What happens if my JSON is invalid?

The tool displays the exact error message from the JSON parser, pointing out where the syntax problem occurs so you can fix it quickly.

Are unicode characters and emoji preserved?

Yes. The browser's built-in parser handles all valid unicode, including surrogate pairs for emoji, and the output retains them exactly.

Is my data uploaded anywhere?

No. Parsing and conversion run entirely in your browser. Nothing leaves your device.

Can I convert a bare JSON string or number?

Yes. If the root value is a primitive rather than an object or array, the output is simply that primitive value.