# YAML to JSON & JSON to YAML Converter (`hipersoft/yaml-json-converter`) Actor

Convert YAML to JSON or JSON to YAML, both ways, with auto-detect and multi-document support. Paste content, pass a list, or fetch from a URL. Great for config files, CI/CD, Kubernetes, OpenAPI and data pipelines. Download the result as a file or inline JSON, CSV or Excel.

- **URL**: https://apify.com/hipersoft/yaml-json-converter.md
- **Developed by:** [hiper soft](https://apify.com/hipersoft) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.001 / document converted

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## YAML to JSON & JSON to YAML Converter

Convert **YAML to JSON** and **JSON to YAML** in either direction with the **YAML / JSON Converter**. Paste your content, pass a whole list, or fetch it from a URL — the converter **auto-detects the format**, handles **multi-document YAML**, and gives you clean, indented output. Download each conversion as a ready file or as inline data in **JSON, CSV or Excel**.

Perfect for **config files, CI/CD pipelines, Kubernetes and Docker Compose manifests, OpenAPI/Swagger specs and data-pipeline glue** in n8n, Make and Zapier, it moves between the two most common config formats with zero code.

### What it does

- 🔄 **Both directions** — YAML → JSON and JSON → YAML.
- 🧭 **Auto-detect** — figures out whether your input is YAML or JSON and converts the other way.
- 📄 **Multi-document YAML** — handles `---` separated documents and returns them as an array.
- ✨ **Clean output** — pretty-printed JSON and tidy, readable YAML.
- 📚 **Batch & URL** — convert one document, a list of documents, or fetch a document from a URL.
- 📎 **File + inline output** — each result is saved as a downloadable file and (when small) included inline in the dataset.
- 📤 **Export anywhere** — JSON, CSV or Excel, or wire the output field into the next step of an automation.

### Example

**YAML in**

```yaml
name: my-app
version: 1.2.0
ports:
  - 8080
  - 9090
```

**JSON out**

```json
{ "name": "my-app", "version": "1.2.0", "ports": [8080, 9090] }
```

### How to use it

1. Paste your **content** (or add a list, or a **URL** to fetch).
2. Choose a **direction** — Auto, YAML → JSON, or JSON → YAML.
3. Optionally toggle **pretty-print** for JSON.
4. Run, and download the converted file or read it from the results.

### Input fields

| Field | Description |
|-------|-------------|
| **Content** | The YAML or JSON to convert. |
| **Multiple documents** | Optional list of documents to convert in one run. |
| **Fetch from URL** | Optional URL to a YAML/JSON document. |
| **Direction** | Auto-detect, YAML → JSON, or JSON → YAML. |
| **Pretty-print JSON** | Indent JSON output. |

### Output fields

`index`, `ok`, `from`, `to`, `bytesIn`, `bytesOut`, `error`, `fileKey`, `fileUrl`, `output` (inline for small results).

### Popular use cases

- **Config conversion** — move between YAML and JSON config formats instantly.
- **Kubernetes & Docker** — turn manifests and Compose files into JSON for tooling, and back.
- **OpenAPI / Swagger** — convert API specs between YAML and JSON.
- **CI/CD** — adapt pipeline definitions to whatever a tool expects.
- **Automation glue** — a conversion step inside an n8n, Make or Zapier workflow.

### FAQ

**Do I need an account or key?**
No. Paste your content and run.

**Does it support multi-document YAML?**
Yes — YAML files with multiple `---` documents are parsed and returned together as an array.

**Can I convert many documents at once?**
Yes — add a list of documents and each is converted independently, with its own downloadable file.

**Where does the converted file go?**
Each conversion is saved to the run's storage with a direct download link in the results; small results are also included inline.

**Can I export to Excel or Google Sheets?**
Yes — the results table downloads as JSON, CSV or Excel and integrates with Sheets and automation tools.

***

Convert **YAML ↔ JSON** both ways — auto-detected, multi-document aware, cleanly formatted and export-ready for configs, CI/CD and automation.

# Actor input Schema

## `content` (type: `string`):

The YAML or JSON to convert. Paste it here. For multiple documents use the list below, or fetch from a URL.

## `contents` (type: `array`):

Optional — a list of YAML/JSON documents to convert in one run. Each is converted independently.

## `contentUrl` (type: `string`):

Optional — a URL to a YAML or JSON document to fetch and convert.

## `direction` (type: `string`):

Which way to convert. Auto-detects from the input when set to Auto.

## `pretty` (type: `boolean`):

Indent JSON output for readability (YAML output is always indented).

## Actor input object example

```json
{
  "contents": [],
  "direction": "auto",
  "pretty": true
}
```

# Actor output Schema

## `results` (type: `string`):

The results as dataset items.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "content": "",
    "contents": []
};

// Run the Actor and wait for it to finish
const run = await client.actor("hipersoft/yaml-json-converter").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "content": "",
    "contents": [],
}

# Run the Actor and wait for it to finish
run = client.actor("hipersoft/yaml-json-converter").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "content": "",
  "contents": []
}' |
apify call hipersoft/yaml-json-converter --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,hipersoft/yaml-json-converter"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/pNdhzIuIzbqdzXwNL/builds/JkufsxuY1AClsgQYV/openapi.json
