json-validate
POST1 kredytParses 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.
Endpoint
POST https://x114.org/api/v1/json-validateTreść żądania
Opis ładunku żądania.
| 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". |
Treść odpowiedzi
Odpowiedź o sukcesie jest zwracana jako JSON.
| 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). |
Przykład
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"}'