How to use the json key extractor
- Paste your JSON text into the input area.
- Choose an output format: one key per line, dot-notation paths, or comma-separated.
- The extracted keys appear instantly as you type or paste.
- Copy the result for use in code, documentation, or data mapping.
How the JSON key extractor works
The tool uses JSON.parse to turn your text into a JavaScript value, then walks the resulting tree recursively. When it encounters an object, it reads each property name with Object.keys(). Arrays are iterated by index, and each element is inspected in turn. A Set collects the keys so that duplicates are removed automatically while preserving the order of first appearance.
For example, given {"user":{"id":1,"role":"admin"},"id":2}, the parser visits the root object and finds user and id. It then descends into the user object and finds id and role. Because id was already recorded, the final unique list is: user, id, role.
Output formats explained
The three output modes serve different workflows:
- One key per line gives a flat list of every distinct property name found anywhere in the document. This is useful when you only need to know which field names exist, regardless of depth.
- Dot-notation paths shows the full route to each key, such as
user.profile.email. This mode helps when you need to reference deeply nested values in code or configuration. - Comma-separated joins the flat key list with commas, making it easy to paste into function arguments, SQL column lists, or spreadsheet headers.
Handling edge cases
Real-world JSON is not always simple. This JSON key extractor accounts for several common edge cases:
- Empty objects and arrays produce no keys and return an empty result rather than an error.
- Primitive roots like a bare string, number, boolean, or null have no keys. The tool returns an empty output instead of crashing.
- Unicode property names such as
"café"or"名前"are fully supported becauseJSON.parsehandles UTF-8 natively. - Duplicate keys across levels are deduplicated in flat mode but shown separately in dot-notation mode, since
a.idandb.idare distinct paths. - Invalid JSON triggers a clear parse error message indicating the position where parsing failed, so you can fix the input quickly.
Common reference table
The following table shows how different JSON structures map to extracted keys in flat mode:
| JSON input | Extracted keys |
|---|---|
{"a":1} | a |
{"a":{"b":1}} | a, b |
[{"x":1},{"x":2}] | x |
{"a":1,"b":[{"c":2}]} | a, b, c |
null | (empty) |
Practical use cases
Extracting keys from JSON is a frequent task in data engineering and frontend development. When you receive an unfamiliar API response, listing its keys reveals the schema without reading through hundreds of lines of nested data. If you are building a transformation pipeline, knowing every property name helps you write accurate mapping logic before converting data to other formats like XML or generating typed classes in languages such as Go or Java.
Another common scenario is auditing large datasets. By extracting all keys across many records, you can spot inconsistent naming conventions, deprecated fields, or unexpected properties that might cause downstream errors. Pairing this tool with a formatter or viewer makes exploring complex payloads straightforward.
Worked examples
| Example | Input | Result |
|---|---|---|
| Simple object | JSON input: {"name":"Ada","age":36,"active":true}; Output format: list | name / age / active |
| Nested object | JSON input: {"user":{"id":1,"profile":{"email":"a@b.com"}}}; Output format: dot | user / user.id / user.profile / user.profile.email |
| Array of objects | JSON input: [{"x":1},{"y":2},{"x":3}]; Output format: list | x / y |
| Unicode keys | JSON input: {"名前":"太郎","café":true}; Output format: comma | 名前, café |
FAQ
Does this tool handle deeply nested JSON?
Yes. The extractor walks the entire tree recursively, so keys at any depth are found. Dot-notation mode shows the full path to each nested property.
Are duplicate keys removed?
In flat and comma-separated modes, each unique key name appears only once. In dot-notation mode, paths are deduplicated, so identical paths at the same location are merged.
What happens if I paste invalid JSON?
The tool displays a clear error message with the approximate position where parsing failed, so you can correct the syntax.
Can I extract keys from a JSON array?
Yes. When the root value is an array, the extractor iterates over each element and collects keys from any objects found inside.
Is my data sent to a server?
No. Parsing and extraction happen entirely in your browser using JavaScript. Nothing leaves your device.
Do unicode property names work?
Yes. Property names containing non-ASCII characters, emojis, or scripts like Japanese are extracted correctly because the underlying JSON parser supports full Unicode.