Json keys
Exactjson_keysDeterministic and authoritative — the canonical answer for this input.
Enumerate a JSON document's structure: top-level keys and their types, plus total leaf count and maximum nesting depth. Useful for inspecting an unfamiliar payload before processing it. Processing multiple inputs? Use `json_keys_batch` to do up to 1000 in one call.
Parameters
valuestringrequiredThe JSON document to inspect.
Call it
curl -X POST https://api.snipget.ai/v1/json/keys \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{"value":"{\"name\": \"Ada\", \"age\": 36, \"roles\": [\"admin\", \"editor\"]}"}'The Batch tab sends up to 1000 inputs in one call via /v1/json/keys/batch.
Example response
{
"input": "{\"name\": \"Ada\", \"age\": 36, \"roles\": [\"admin\", \"editor\"]}",
"is_valid": true,
"type": "object",
"keys": [
"name",
"age",
"roles"
],
"key_count": 3,
"types": {
"name": "string",
"age": "number",
"roles": "array"
},
"leaf_count": 4,
"max_depth": 2
}FAQ
What do I get back?
A quick map of the document's shape: its top-level keys and each one's type, plus how many values it holds in total and how deeply it nests. It is a fast way to understand an unfamiliar JSON blob before working with it.
Are these counts exact?
Yes. The key count, leaf count, and depth are all computed deterministically, so they are authoritative, not estimates.
Does it list every nested key?
No. It only names the top-level keys and their types. Leaf count and max depth summarize what is below, but if you want every nested path by name, use Flatten instead.
What is the difference between leaf count and key count?
Key count is just the number of keys at the top level. Leaf count is the total number of actual values anywhere in the document, including inside nested objects and lists.
What if the JSON is invalid?
You get a result with confidence 0 and a reason rather than an error, so you can detect and fix the bad input before relying on the structure.