JSON Utilities

Unflatten Json

Converts flattened JSON objects with dot-notation keys back into nested structures. Access via MCP in Cursor or other AI editors, or REST at GET /v1/json/unflatten. Transform {"user.name": "John", "user.age": 30} into {"user": {"name": "John", "age": 30}}. Perfect for rebuilding hierarchical data from database exports or form submissions.

API Endpoint

GET /v1/json/unflatten

Code Examples

curl "https://tinyfn.io/v1/json/unflatten" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/json/unflatten', {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests

response = requests.get('https://tinyfn.io/v1/json/unflatten',
    headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)

Use via MCP

Add to your AI agent

Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's json tools:

{
  "mcpServers": {
    "tinyfn-json": {
      "url": "https://tinyfn.io/mcp/json",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

How does JSON unflatten handle dot-notation keys?

It converts keys like 'user.profile.name' into nested objects: {'user': {'profile': {'name': value}}}. Each dot creates a new nesting level.

What happens with array indices in flattened JSON keys?

Numeric keys become array indices. 'items.0.name' and 'items.1.name' create an array with two objects at items[0] and items[1].

Can MCP agents use unflatten to process form data in AI workflows?

Yes, AI agents can unflatten form submissions or CSV-to-JSON conversions automatically. Useful for transforming flat data into structured objects for further processing.

Does unflatten preserve data types from the original flat structure?

It maintains the original value types (strings, numbers, booleans, null) while only restructuring the key hierarchy.

How does it handle conflicting keys like 'user' and 'user.name'?

Object keys take precedence. If both exist, the nested structure ('user.name') will override scalar values at the same path.

Try Unflatten Json Now

Get your free API key and start using Unflatten Json in seconds.

Get Free API Key