YAML ↔ JSON Converter API

Convert YAML to JSON and JSON to YAML online. Bidirectional, validated conversion with error locations. Free, fast, 100% client-side.

The YAML ↔ JSON Converter is also available as a free REST API. Send a POST request with a JSON body to https://dot.tools/api/tools/yaml-json — no authentication, no API key, CORS enabled. Successful calls return { "ok": true, "result": { … } }; failures return HTTP 400 or 422 with an error body.

Request body

FieldTypeRequiredDescription
mode"yaml-to-json" | "json-to-yaml"requiredConversion direction: YAML to JSON, or JSON to YAML.
inputstringrequiredThe YAML or JSON text to convert.
indent"2" | "4"requiredNumber of spaces per indentation level in the output.

Response

FieldTypeRequiredDescription
outputstringrequiredThe converted document. Empty when the input is invalid.
validbooleanrequiredWhether the input parsed successfully.
errorunknownrequiredParse error message when invalid.
errorLineunknownrequired1-based line of the parse error when invalid.
errorColumnunknownrequired1-based column of the parse error when invalid.

Example request

curl -X POST https://dot.tools/api/tools/yaml-json \
  -H 'Content-Type: application/json' \
  -d '{
  "mode": "yaml-to-json",
  "indent": "2",
  "input": "name: dot.tools\nversion: 2.0.0\nprivate: true\ntools:\n  - json-formatter\n  - xml-formatter\n  - yaml-json\nmeta:\n  clientSide: true\n  category: format"
}'

Sample response

{
  "ok": true,
  "result": {
    "output": "{\n  \"name\": \"dot.tools\",\n  \"version\": \"2.0.0\",\n  \"private\": true,\n  \"tools\": [\n    \"json-formatter\",\n    \"xml-formatter\",\n    \"yaml-json\"\n  ],\n  \"meta\": {\n    \"clientSide\": true,\n    \"category\": \"format\"\n  }\n}",
    "valid": true,
    "error": null,
    "errorLine": null,
    "errorColumn": null
  }
}

Use the free YAML ↔ JSON Converter in your browser, read the YAML ↔ JSON Converter guide, or import the full OpenAPI specification.