json-validate
POST1 кредитParses a JSON string and returns either a pretty-printed version or a structured error pointing at the line and column of the failure. Useful for CI linting and form validation.
Эндпоинт
POST https://x114.org/api/v1/json-validateТело запроса
Отправлять как JSON в теле POST.
| Name | Type | Required | Description |
|---|---|---|---|
| json | string | required | The JSON text to validate. |
| mode | "validate" | "format" | "minify" | optional | What to do with the input. "validate" parses and reports; "format" pretty-prints with 2-space indent; "minify" strips whitespace. Defaults to "validate". |
Тело ответа
JSON возвращается при успехе (HTTP 200).
| Name | Type | Required | Description |
|---|---|---|---|
| ok | boolean | required | True on a well-formed response (parse error still surfaces). |
| mode | string | required | Echoes the mode that was applied. |
| valid | boolean | required | True when the JSON parses; false when a parse error is reported. |
| type | string | optional | Top-level JSON type ("object"|"array"|"string"|"number"|"boolean"|"null"). Only set in validate mode on success. |
| data | string | optional | Formatted or minified JSON string. Only set in format/minify mode on success. |
| size | number | optional | Size in characters of the input (validate) or output (format/minify). |
| error | string | optional | Human-readable error message (only set when valid is false). |
Пример
curl -X POST https://x114.org/api/v1/json-validate \
-H "Authorization: Bearer sk_..." \
-H "Content-Type: application/json" \
-d '{"json":"{\"a\":1}","mode":"format"}'