Extracts all top-level keys from a JSON object as an array. Use via MCP in Cursor or Windsurf, or call GET /v1/json/keys with your JSON payload. Returns ["name", "age", "city"] from {"name": "Alice", "age": 30, "city": "NYC"}. Only processes the immediate keys, not nested objects.
curl "https://tinyfn.io/v1/json/keys" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/json/keys', {
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/keys',
headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)
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"
}
}
}
}
Call the get_keys tool with your JSON object. It returns an array of all top-level property names.
Only returns immediate top-level keys. For nested objects like {"user": {"profile": {}}}, you get ["user"], not the inner keys.
Returns an empty array []. Arrays and primitive values return empty arrays since they have no object keys.
Arrays don't have named keys, so the tool returns an empty array. Use this specifically for JSON objects with key-value pairs.
Identical behavior to Object.keys() but deterministic and accessible to AI agents via MCP without code execution risks.