Json unflatten
Exactjson_unflattenDeterministic and authoritative — the canonical answer for this input.
Inverse of json_flatten: rebuild a nested JSON object from a flat map of dotted-path keys. Digit segments running 0..n-1 become array elements. Processing multiple inputs? Use `json_unflatten_batch` to do up to 1000 in one call.
Parameters
valuestringrequiredA flat JSON object of dotted-path keys.
separatorstringoptionalPath separator splitting the keys.
Call it
curl -X POST https://api.snipget.ai/v1/json/unflatten \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{"value":"{\"user.name\": \"Ada\", \"user.address.city\": \"London\"}"}'The Batch tab sends up to 1000 inputs in one call via /v1/json/unflatten/batch.
Example response
{
"input": "{\"user.name\": \"Ada\", \"user.address.city\": \"London\"}",
"is_valid": true,
"nested": {
"user": {
"name": "Ada",
"address": {
"city": "London"
}
}
},
"separator": "."
}FAQ
What does this do?
It takes a flat object whose keys are dotted paths, like user.address.city, and rebuilds the proper nested JSON from it. It is the exact inverse of Flatten, so a flatten followed by an unflatten returns the original.
How do lists come back?
When the path segments are plain numbers running 0, 1, 2 and so on with no gaps, they are rebuilt as a list. So users.0.email and users.1.email become a two-item list again.
Can I use a different separator?
Yes. The default is a dot, but set separator to match whatever joiner your keys use, for example a slash.
Does the input have to be a flat object?
Yes. It expects a single flat JSON object of dotted keys. If you pass a list or a bare value, you get confidence 0 and a reason explaining it needs a flat object.
What if the JSON is malformed?
It returns confidence 0 with a short reason instead of an error, so it is safe to call on untrusted text.