---
title: "Convert JSON5, JSONC (tsconfig, VS Code settings) and relaxed JSON to strict JSON, or reformat them with comments kept, reporting every non-JSON feature used."
method: POST
path: "/api/v1/jsonc"
tags: ["Converters"]
---

# Convert JSON5, JSONC (tsconfig, VS Code settings) and relaxed JSON to strict JSON, or reformat them with comments kept, reporting every non-JSON feature used.

`POST /api/v1/jsonc`

## Request

- Base URL: `https://programmes.net`
- URL: `https://programmes.net/api/v1/jsonc`
- Auth: none declared

JSON5 / JSONC to JSON. Operations: `to-json` — Convert JSON5 / JSONC to strict RFC 8259 JSON. `format` — Re-print JSON / JSON5 / JSONC tidily as JSONC or JSON5, keeping comments. `validate` — Check whether text is valid JSON5 and list which non-JSON features it uses.

## Request body

- union
  - JsoncToJson: Convert JSON5 / JSONC to strict RFC 8259 JSON.
    - `operation` 'to-json', required
    - `input` string: JSON5, JSONC or JSON text.
    - `options` object
      - `indent` integer: Spaces per level (0 = minified).
      - `specials` 'null' | 'string' | 'error': How to write Infinity / NaN, which JSON cannot represent.
  - JsoncFormat: Re-print JSON / JSON5 / JSONC tidily as JSONC or JSON5, keeping comments.
    - `operation` 'format', required
    - `input` string: JSON5, JSONC or JSON text.
    - `options` object
      - `style` 'jsonc' | 'json5': jsonc = double quotes; json5 = unquoted keys and single quotes.
      - `trailingCommas` boolean: Add trailing commas.
      - `keepComments` boolean: Keep comments.
      - `indent` integer: Spaces per level.
  - JsoncValidate: Check whether text is valid JSON5 and list which non-JSON features it uses.
    - `operation` 'validate', required
    - `input` string: JSON5, JSONC or JSON text.
    - `options` object

## Response `200`

The operation ran.

- object
  - `ok` unknown, required
  - `tool` 'jsonc', required
  - `operation` 'to-json' | 'format' | 'validate', required
  - `result` unknown, required

## Other responses

- `400`: The request is not valid (https://programmes.net/api#invalid-request); The tool has no such operation (https://programmes.net/api#unknown-operation)
- `404`: No such tool (https://programmes.net/api#unknown-tool)
- `413`: The request or its input is too large (https://programmes.net/api#content-too-large)
- `415`: The body must be JSON (https://programmes.net/api#unsupported-media-type)
- `422`: An option is missing, of the wrong type or out of range (https://programmes.net/api#invalid-options); This call needs more CPU than one API call may use (https://programmes.net/api#refused); The operation could not process the input (https://programmes.net/api#tool-error)
- `429`: Too many requests (https://programmes.net/api#rate-limited)
- `500`: Internal error (https://programmes.net/api#internal-error)

---

[API](https://skmtc.dev/programmes/apis/programmes-net-api.md) · [All operations](https://skmtc.dev/programmes/apis/programmes-net-api/llms.txt) · [OpenAPI document](https://skmtc.dev/programmes/apis/programmes-net-api/revisions/aa939784a2e6?raw)
