{"uid":"cap_gAWg3ruGOcGtObA1Ait_t","slug":"flatten-nested-json-to-leaf-paths-babfbff8","name":"Flatten Nested JSON to Leaf Paths","description":"Flatten nested JSON to leaf paths — Genesis402 / UnyKorn Operator Network","url":"https://twin.unykorn.org/json-flatten?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"params":{"type":"object","properties":{"json":{},"separator":{"type":"string"}}}}},"responseSchema":{"type":"json","example":{"ok":true,"type":"json-flatten","receipt":{"tx_hash":"0x<64hex>","amount_usd":0.002,"receipt_id":"g402-<16hex>"},"generated_at":"<iso8601>"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.002","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.002/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_qE_p3x_-sBYeCzfAUhoPX","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.002","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Accepts a nested JSON object and returns a flat mapping of dot-separated (or custom-separator) leaf paths to their scalar values.","exampleAgentPrompt":"Flatten this nested JSON into dot-separated leaf paths: {\"user\":{\"name\":\"Alice\",\"address\":{\"city\":\"NYC\",\"zip\":\"10001\"}},\"active\":true} — use a dot as the separator.","exampleUseCases":[{"title":"Normalize nested API response for logging","prompt":"I got this deeply nested JSON back from a third-party API and I need to log every field as a flat key-value pair using dot notation — can you flatten it for me? Here's the object: {\"order\":{\"id\":\"abc123\",\"customer\":{\"name\":\"Bob\",\"email\":\"bob@example.com\"},\"items\":[{\"sku\":\"X1\",\"qty\":2}]}}"},{"title":"Prepare config object for env variable export","prompt":"Take this nested config JSON and flatten it using double underscores as the separator so I can export each leaf as an environment variable: {\"database\":{\"host\":\"localhost\",\"port\":5432,\"credentials\":{\"user\":\"admin\",\"pass\":\"secret\"}}}"},{"title":"Convert nested form data for spreadsheet ingestion","prompt":"I have a bunch of nested JSON survey responses and I need them flattened to single-level key-value pairs with a slash separator so I can load them into a spreadsheet — here's one record: {\"respondent\":{\"age\":34,\"location\":{\"country\":\"US\",\"state\":\"CA\"}},\"score\":8}"}],"resultDescription":"Returns a JSON object with ok: true, a flat mapping of all leaf paths (joined by the specified separator) to their scalar values, the transformation type label, and a payment receipt containing the transaction hash, USD amount charged, and a unique receipt ID.","failureModes":["Invalid or malformed JSON input returns an error response","Non-string separator values may be rejected or ignored","Payment failure via x402 protocol results in 402 status and no transformation","Very large or deeply recursive JSON may time out or exceed payload limits","Arrays within the JSON may be indexed or omitted depending on implementation"],"whenToPreferThis":"Use this endpoint when you need a quick, paid, serverless transformation of arbitrarily nested JSON into a flat key-path structure without setting up local parsing libraries. It is particularly useful inside agent pipelines where you want to normalize API responses, prepare data for storage or logging, or export nested configs as environment variables, and you need a reliable hosted service with a payment receipt for audit purposes.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-01T18:55:31.979Z","isFirstParty":false,"canonicalSlug":"flatten-nested-json-to-leaf-paths-babfbff8"}