---
title: "Use this when converting between YAML and JSON in either direction, or normalizing one format in place (set from equal to to)."
method: POST
path: "/v1/convert_yaml"
tags: ["data"]
---

# Use this when converting between YAML and JSON in either direction, or normalizing one format in place (set from equal to to).

`POST /v1/convert_yaml`

## Request

- Base URL: `https://api.clean.tools`
- URL: `https://api.clean.tools/v1/convert_yaml`
- Auth: none declared

Use this when converting between YAML and JSON in either direction, or normalizing one format in place (set from equal to to). Deterministic: same input, same output. Parses a single YAML document and caps alias expansion at 100 to defuse billion-laughs bombs; multi-document input, tabs-as-indentation, and other parse errors return a typed error with the line number. Example: { data: "name: web\nport: 8080", from: "yaml", to: "json" } -> { result: "{\n  \"name\": \"web\",\n  \"port\": 8080\n}" }.

## Request body

- object
  - `data` string, required: The document to convert, as a string.
  - `from` 'yaml' | 'json', required: Input format of data.
  - `to` 'yaml' | 'json', required: Output format; if equal to "from", the document is normalized (parsed and re-emitted).

## Response `200`

Structured tool result.

- object
  - `tool` string
  - `result` object
    - `result` string, required: The converted (or, when from equals to, normalized) document as text in the target format.

## Other responses

- `400`: Invalid input or the tool reported an error.
- `413`: Request body exceeds the 128 KB limit.
- `429`: Rate limit exceeded; the response carries Retry-After and RateLimit-* headers — honor them and add jitter.

---

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