JSON Sort Keys API¶
Overview¶
Sorts object keys recursively using case-insensitive ordering. Array order is preserved.
Endpoint¶
POST https://api.apidatatools.com/json-sort-keys-api
Authentication¶
Include x-api-key: YOUR_API_KEY.
Input modes¶
Supports synchronous body mode and asynchronous url and file modes.
Headers¶
| Header | Required | Default | Description |
|---|---|---|---|
x-api-key | Yes | — | API key. |
x-source-type | No | body | Input mode. |
x-descending | No | false | Sort keys in descending order when true. |
Accepted file extensions¶
.txt, .json, and .log.
curl example¶
curl -X POST 'https://api.apidatatools.com/json-sort-keys-api' \\
-H 'x-api-key: YOUR_API_KEY' \\
--data-raw '{"z":1,"a":{"D":2,"b":1}}'
URL and file modes¶
URL mode sends {"url":"https://example.com/input.json"}; file mode sends {"file":"S3_KEY_RETURNED_BY_THE_UPLOAD_WORKFLOW"}. Set x-source-type accordingly and include x-descending if needed.
curl --request POST --url https://api.apidatatools.com/json-sort-keys-api \
--header 'x-api-key: YOUR_API_KEY' --header 'x-source-type: url' \
--header 'x-descending: true' --header 'Content-Type: application/json' \
--data '{"url":"https://example.com/input.json"}'
curl --request POST --url https://api.apidatatools.com/json-sort-keys-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, file, and preview. URL/file submission returns HTTP 202 with job_id and status_url. Poll GET /jobs/JOB_ID with the same API key. Queued/processing responses include retry_after; success includes result.file and result.preview; failure includes an error object.
{"status":"accepted","job_id":"JOB_ID","status_url":"https://api.apidatatools.com/jobs/JOB_ID","request_id":"REQUEST_ID"}
Error handling¶
| HTTP status | Error codes |
|---|---|
400 | INVALID_SOURCE_TYPE, INVALID_BODY_ENCODING, EMPTY_BODY, INVALID_JSON, INVALID_JSON_ENCODING, 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 requests may return URL/file validation errors, FILE_TOO_LARGE, CONFIG_ERROR, or PLAN_CONFIG_ERROR. Job failures include DOWNLOAD_FAILED, UPLOAD_FAILED, and tool errors. Status errors include INVALID_JOB_ID, JOB_NOT_FOUND, FORBIDDEN, and DDB_ERROR.
Notes¶
Honor retry_after. Limits and temporary output retention depend on your plan.