JSON Unflatten API¶
Overview¶
Reconstructs nested JSON from an object keyed by RFC 6901 JSON Pointer paths.
Endpoint¶
POST https://api.apidatatools.com/json-unflatten-api
Authentication¶
Include x-api-key: YOUR_API_KEY.
Input modes¶
Supports body, url, and file. Body mode is synchronous; the other modes are asynchronous.
Headers¶
| Header | Required | Default | Description |
|---|---|---|---|
x-api-key | Yes | — | API key. |
x-source-type | No | body | body, url, or file. |
Accepted file extensions¶
.txt, .json, and .log.
curl example¶
curl -X POST 'https://api.apidatatools.com/json-unflatten-api' \\
-H 'x-api-key: YOUR_API_KEY' \\
--data-raw '{"/user/name":"Ada","/user/roles/0":"admin"}'
Request rules¶
The root must be an object of pointer/value pairs. An empty-string root pointer may only appear by itself. Array segments must be non-negative integers, and overlapping paths are rejected.
URL and file modes¶
URL mode sends {"url":"https://example.com/input.json"} with x-source-type: url; file mode sends {"file":"S3_KEY_RETURNED_BY_THE_UPLOAD_WORKFLOW"} with x-source-type: file.
curl --request POST --url https://api.apidatatools.com/json-unflatten-api \
--header 'x-api-key: YOUR_API_KEY' --header 'x-source-type: url' \
--header 'Content-Type: application/json' --data '{"url":"https://example.com/input.json"}'
curl --request POST --url https://api.apidatatools.com/json-unflatten-api \
--header 'x-api-key: YOUR_API_KEY' --header 'x-source-type: file' \
--header 'Content-Type: application/json' --data '{"file":"S3_KEY_RETURNED_BY_THE_UPLOAD_WORKFLOW"}'
Success and async process¶
Body mode returns HTTP 200 with request_id, status, temporary file, and preview. Async submission returns HTTP 202 with status: accepted, job_id, status_url, and request_id.
Poll GET https://api.apidatatools.com/jobs/JOB_ID using the same API key. queued and processing include message and retry_after; success includes result.file and result.preview; failed includes error.code, error.message, and error.details.
{"request_id":"REQUEST_ID","job_id":"JOB_ID","status":"queued","created_at":1730000000,"updated_at":1730000000,"message":"Your job is being processed.","retry_after":2}
Error handling¶
Errors use the standard status, error, request_id, and details.message envelope.
| HTTP status | Error codes |
|---|---|
400 | INVALID_SOURCE_TYPE, INVALID_BODY_ENCODING, EMPTY_BODY, INVALID_FLAT_JSON, INVALID_JSON_POINTER, INVALID_ARRAY_INDEX, PATH_CONFLICT, INVALID_JSON, JSON_TOO_DEEP |
401 | UNAUTHORIZED |
404 | USER_NOT_FOUND, UNKNOWN_FUNCTION |
413 | PAYLOAD_TOO_LARGE |
429 | QUOTA_EXCEEDED, RATE_LIMITED |
500 | PLAN_NOT_FOUND, AUTH_ERROR, INTERNAL_ERROR |
Async submission errors include INVALID_BODY, URL/file validation errors, FILE_TOO_LARGE, CONFIG_ERROR, and PLAN_CONFIG_ERROR. Status errors include INVALID_JOB_ID, JOB_NOT_FOUND, FORBIDDEN, and DDB_ERROR. Processing failures include INVALID_JOB, DOWNLOAD_FAILED, UPLOAD_FAILED, and tool errors.
Notes¶
- Honor
retry_afterwhen polling. - Plan limits govern size, quota, rate, and retention.
- Download URLs are temporary.