# YAML to JSON converter

> Convert YAML to JSON or JSON to YAML online, with clear syntax errors. Handy for Docker Compose, Kubernetes, CI and OpenAPI files. Free.

Free tool by Orkosi. Page: https://orkosi.com/tools/yaml-json-converter

Move a config between the two formats tools disagree on. Paste a Compose file, a workflow or an OpenAPI document and get the other format, or the line where the syntax breaks.

1. Paste the YAML or the JSON.
2. Choose the direction.
3. Press Convert and copy the result.

## Input

| Field | Type | Required | What it is |
| --- | --- | --- | --- |
| `text` | text | yes | YAML or JSON. |
| `direction` | "yaml-to-json" \| "json-to-yaml" | no | Direction. Default: "yaml-to-json". |

## Example

Input:

```json
{
  "text": "services:\n  web:\n    image: nginx:1.27\n    ports:\n      - \"80:80\"\n    restart: always\n",
  "direction": "yaml-to-json"
}
```

Result:

```json
{
  "output": "{\n  \"services\": {\n    \"web\": {\n      \"image\": \"nginx:1.27\",\n      \"ports\": [\n        \"80:80\"\n      ],\n      \"restart\": \"always\"\n    }\n  }\n}"
}
```

## Run it

It needs a free Orkosi account, nothing else. No credits are used.

- **A person**: open the page, enter an e-mail once, use the tool.
- **Claude or ChatGPT**: add the Orkosi connector `https://orkosi.com/api/v1/public/mcp` and sign in, or create the free account on the sign-in page. Then call `orkosi_run_free_tool` with `{ "tool": "yaml-json-converter", "input": { … } }`.
- **Any agent or program that can make an HTTP request**:

  1. Once, create the account: `POST https://orkosi.com/api/v1/public/signup` with `{ "name": "…", "email": "…", "terms_accepted": true }` and no key. Ask the person for the e-mail and their agreement to the terms first. The answer carries `data.api_key`, shown once.
  2. Run the tool:

```bash
curl -X POST https://orkosi.com/api/v1/public/tools/yaml-json-converter/run \
  -H "Authorization: Bearer $ORKOSI_API_KEY" -H "Content-Type: application/json" \
  -d '{"input":{"text":"services:\n  web:\n    image: nginx:1.27\n    ports:\n      - \"80:80\"\n    restart: always\n","direction":"yaml-to-json"}}'
```

The answer is `{ "data": { "tool": "…", "result": { … } } }`. A call without a key is answered 401 with the signup steps as data.

## Questions

**Are comments kept?**

No. JSON has no comments, so they are lost going from YAML to JSON, and JSON has none to carry back.

**Which YAML version is read?**

YAML 1.2, the version current tools use. Anchors and aliases are resolved into plain values.

**Why does my YAML fail?**

Most often a tab used for indentation or a missing space after a colon. The error names the line.

All free tools: https://orkosi.com/tools.md
