Skip to main content

yaml_to_json

Convert a YAML string to pretty-printed JSON.

Parameters​

ParameterTypeRequiredDescription
inputstringYesYAML string to convert.

Response​

FieldTypeDescription
outputstringThe converted pretty-printed JSON string.

Example​

{
"input": "name: Alice\nage: 30\nactive: true\n"
}

Result:

{
"output": "{\n \"name\": \"Alice\",\n \"age\": 30,\n \"active\": true\n}"
}

Errors​

Each failure carries a precise code in the response. Argument-schema and server errors are JSON-RPC protocol errors; a rejected value is returned as a tool result with isError: true (so the agent can read the code and self-correct).

CodeWhenDelivered as
invalid_argumentsinput is missing or not a string.protocol error (invalid_params)
invalid_yamlThe input string is not valid YAML.tool error (isError)
internal_errorAn unexpected server error.protocol error (internal_error)

Notes​

  • YAML timestamps and other non-JSON types are converted to strings.
  • Multi-document YAML (separated by ---) is not supported and will cause an error.