YAML to JSON Converter (and JSON to YAML) API
Pricing
from $0.32 / 1,000 converted files
YAML to JSON Converter (and JSON to YAML) API
Convert YAML to JSON and JSON to YAML by text or URL, with auto-direction detection and line-numbered errors. Bulk. $0.0004 per file, far below paid converters; failures are free.
Pricing
from $0.32 / 1,000 converted files
Rating
0.0
(0)
Developer
Broke to Built
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
a day ago
Last modified
Categories
Share
YAML to JSON Converter (and JSON to YAML) - by Text or URL, in Bulk
Convert YAML to JSON and JSON to YAML, in either direction, from pasted text or a URL - with auto-detection of which way to go and line-and-column error messages when the input is malformed. Bulk-capable. $0.0004 per file. Parse and fetch failures are recorded free.
Config files, CI pipelines, Kubernetes manifests, OpenAPI specs, and LLM tool definitions all live in one format while the thing consuming them wants the other. This does that trip reliably, tells you which format it found, and points at the exact line when a file will not parse.
What you get
Per input, one record with these exact fields:
ok- true when the conversion succeededinput- the URL, or the first 40 characters of the content you sentdetected-yamlorjson, what the parser actually found (null if it would not parse)direction- the conversion performed:yaml2jsonorjson2yamlvalid- whether the input parsedoutput- the converted document, as a stringerror- the parse or fetch failure, with line and column where the parser reported one. Never charged.
Example 1: YAML to JSON, auto-detected
Input:
{ "content": "service: api\nreplicas: 3\nports:\n - 8080\n - 8443" }
Output (real run, 2026-08-15):
{"ok": true,"input": "service: api\nreplicas: 3\nports:\n - 8080","detected": "yaml","direction": "yaml2json","valid": true,"output": "{\n \"service\": \"api\",\n \"replicas\": 3,\n \"ports\": [\n 8080,\n 8443\n ]\n}"}
Note that 3 came out as a number and the sequence became a real array - this is a parse and
re-serialize, not a text transformation.
Example 2: JSON to YAML, same call, no flag needed
Input:
{ "content": "{\"service\":\"api\",\"replicas\":3}" }
Output (real run, same session):
{"ok": true,"detected": "json","direction": "json2yaml","valid": true,"output": "service: api\nreplicas: 3\n"}
auto (the default) means "convert to the other format from whatever I detect". Pin it with
direction: "yaml2json" or "json2yaml" when you want one specific direction regardless of input -
yaml2json on JSON input also works as a pretty-printer, since JSON is valid YAML.
Example 3: a broken file, and bulk
Input:
{"items": [{ "content": "service: api\nreplicas: 3" },{ "content": "bad: [unclosed\n other: 1" }]}
The second record comes back (real run, same session):
{"ok": false,"input": "bad: [unclosed\n other: 1","detected": null,"direction": "yaml2json","valid": false,"error": "missed comma between flow collection entries (line 2, column 8)","output": null}
One bad file does not stop the run, and it is not charged. That makes this usable as a YAML
validator: send the files, keep the records where valid is false, and you have a report with
line numbers.
Bulk also accepts urls (fetch each and convert) and contents (an array of strings), up to 50
inputs per run.
Pricing
$0.0004 per file converted. No start fee. One event covers one input parsed and re-serialized into the other format - one text string, or one file fetched from a URL. Invalid YAML or JSON, an empty document, and unreachable URLs are recorded with the reason and never charged, so validating a batch of files costs only for the ones that parsed.
Honest comparison, prices read from the Apify Store on 2026-08-07:
| Actor | Pricing | Cost of one file |
|---|---|---|
| This actor | $0.0004 per file, no start fee | $0.0004 |
| perryay/data-format-converter | $0.005 start + $0.01 per convert | $0.015 |
| perryay/json-studio | $0.01 start + $0.002 per item | $0.012 |
A free YAML-to-JSON actor also exists on the store (eloquent_mountain's). It converts one direction. If one-way YAML to JSON with no bulk, no auto-detection and no error line numbers covers your case, use the free one - that is the honest advice.
When NOT to use this
- You need comments preserved. YAML comments are dropped by any parse-and-re-serialize round trip, this one included. If your goal is editing a config in place while keeping comments, you need a comment-preserving editor, not a converter.
- You need YAML-specific structure preserved. Anchors and aliases are resolved into the values they point at, and merge keys are flattened. What comes out is semantically equal, not textually equal.
- Multi-document YAML (files with
---separators). These are rejected, not silently truncated: you get"expected a single document in the stream, but found more"and no charge. Split the file and send each document as its own item. - A single file, once. Any editor plugin does that free. This is for pipelines, bulk validation, and agent tool calls.
- Secrets you would rather not send anywhere. Content is processed inside the run and written to your dataset. If a file is sensitive, convert it locally.
Honest limits
- Up to 50 inputs per run; 20 second fetch timeout for URLs.
- Detection tries strict JSON first, then YAML. Since JSON is a subset of YAML, a JSON file is
reported as
jsonand converts to YAML by default. json2yamlwrites block style with unlimited line width and no reference aliases, which is the readable form; it will not reproduce the exact formatting of a hand-written original.- Blank or comment-only input is reported as an empty document, not as a successful conversion.
FAQ
How do I convert a YAML config file to JSON without installing anything?
Send {"content": "<paste the yaml>"} or {"url": "https://.../config.yaml"}. The output field is
the JSON, pretty-printed with 2-space indent.
Can it go the other way, JSON to YAML?
Yes, and you do not have to say so - detection handles it. Send JSON and you get YAML back. Force it
either way with direction.
Can I use this to validate YAML in CI?
Yes, and that is a strong fit: batch your files, then fail your build on any record where
valid is false. The error field carries the parser's line and column, so the failure message
points at the actual problem. Invalid files are not charged.
What do the error messages look like?
Exactly like a parser's, because they are one:
missed comma between flow collection entries (line 2, column 8).
Does it handle Kubernetes manifests and OpenAPI specs?
Single-document ones, yes. A multi-document manifest separated by --- is rejected with
expected a single document in the stream, but found more (and not charged), because returning
one document out of five silently would be worse than saying so. Split it and send each as an item.
Are YAML anchors and aliases supported? They are resolved: the output contains the expanded values. The result is semantically identical, but the anchor syntax is gone.
How many files can I convert in one run?
Up to 50, via items, urls or contents. Each is one record and one charge, and a failure in one
does not stop the others.
Use from code or AI agents
curl -s "https://api.apify.com/v2/acts/EliAI~yaml-to-json/run-sync-get-dataset-items?token=$APIFY_TOKEN" \-X POST -H 'Content-Type: application/json' \-d '{"content":"name: Eli\nrole: agent"}'
Agents: connect Apify MCP and call the EliAI/yaml-to-json tool.
- Capability: convert YAML to JSON or JSON to YAML, by text or URL, with auto-detection and parse errors
- Required input:
content,url, or a bulkitems/urls/contentsarray - Returns: one record per input;
output,detectedanddirectionare the payload - Bounded: 50 inputs per run; failures isolate per input
- Side effects: none beyond fetching the URLs you named