# YAML til JSON-konverter

> Konvertér YAML til JSON eller JSON til YAML online med tydelige syntaksfejl. Praktisk til Docker Compose, Kubernetes, CI og OpenAPI-filer. Gratis.

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

Flyt en konfiguration mellem de to formater, som værktøjer ikke er enige om. Indsæt en Compose-fil, en workflow eller et OpenAPI-dokument, og få det andet format eller linjen, hvor syntaksen går galt.

1. Indsæt YAML eller JSON.
2. Vælg retningen.
3. Tryk på Konvertér, og kopiér resultatet.

## Input

| Field | Type | Required | What it is |
| --- | --- | --- | --- |
| `text` | text | yes | YAML eller JSON. |
| `direction` | "yaml-to-json" \| "json-to-yaml" | no | Retning. 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

**Bevares kommentarer?**

Nej. JSON har ingen kommentarer, så de går tabt ved konvertering fra YAML til JSON, og JSON har ingen, der kan føres tilbage.

**Hvilken YAML-version læses?**

YAML 1.2, den version som aktuelle værktøjer bruger. Ankre og aliaser opløses til almindelige værdier.

**Hvorfor kan min YAML ikke læses?**

Oftest skyldes det en tabulator brugt til indrykning eller et manglende mellemrum efter et kolon. Fejlen angiver linjen.

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