Data Format Converter πŸ”„ β€” JSON, YAML, TOML, CSV Tool avatar

Data Format Converter πŸ”„ β€” JSON, YAML, TOML, CSV Tool

Pricing

from $0.005 / actor start

Go to Apify Store
Data Format Converter πŸ”„ β€” JSON, YAML, TOML, CSV Tool

Data Format Converter πŸ”„ β€” JSON, YAML, TOML, CSV Tool

Convert, validate, beautify, and minify data between JSON, YAML, TOML, and CSV formats. Supports customizable CSV delimiter, indentation, and key sorting. Batch processing up to 20 items.

Pricing

from $0.005 / actor start

Rating

0.0

(0)

Developer

Perry AY

Perry AY

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

20 hours ago

Last modified

Categories

Share

Data Format Converter πŸ“„ β€” JSON, YAML, TOML, CSV Converter & Validator

Convert, validate, beautify, and minify structured data between JSON, YAML, TOML, and CSV formats. Batch up to 20 items, with deep syntax validation and customizable formatting β€” all in a single deterministic call.

Every development team works with multiple data formats. Configuration files in YAML, API payloads in JSON, application settings in TOML, and tabular data in CSV β€” each format has its strengths, but moving data between them reliably is a constant source of friction. Data Format Converter eliminates that friction: provide any input, specify source and target format, and receive perfectly converted output with full validation, proper escaping, and format-idiomatic structure preservation.

Batch up to 20 items in a single run for bulk ETL workflows, CI/CD pipeline transformations, or configuration file migrations. Every conversion is sandboxed, size-limited, and logged transparently β€” no data leaves the secure Apify execution environment. Four operation modes (convert, validate, beautify, minify) with batch processing for up to 20 items.


What does it do?

Data Format Converter accepts structured data in JSON, YAML, TOML, or CSV format and transforms it to any other supported format while preserving structural fidelity, data types, and nested relationships. The actor handles the full conversion roundtrip: parsing the source format into an internal representation, then serializing that representation into the target format using format-specific best practices (sorted keys, controlled indentation, proper quoting, and delimiter handling).

Beyond simple conversion, the actor provides deep validation that goes beyond basic syntax checking. For JSON inputs, it detects duplicate keys at arbitrary nesting depth, validates type consistency across arrays, and flags non-standard root types. For YAML, it detects merge keys (<<), tab-indentation issues, and ambiguous scalar quoting. For TOML, it validates dotted-key conflicts and table-array consistency. For CSV, it checks row-length uniformity, multi-line cell detection, and quoting correctness. Each validation run produces a structured error list with actionable messages.

The actor also supports beautify and minify modes for format-specific pretty-printing and compaction. Beautify re-serializes any format with controlled indentation, optional key sorting, and proper formatting. Minify produces the most compact possible representation β€” ideal for storage optimization, bandwidth reduction, or preparing data for transmission. JSON minification removes all non-essential whitespace; YAML, TOML, and CSV minification compresses indentation to zero.

Who is it for?

PersonaWhat they use it for
Backend DeveloperConverting API response payloads between JSON and YAML for configuration files, formatting raw JSON logs for debugging, and validating incoming webhook data
Data EngineerTransforming CSV exports into JSON or YAML for downstream processing, normalizing mixed-format data streams in ETL pipelines, and validating schema consistency across format boundaries
DevOps / SRE EngineerConverting Kubernetes manifests, Ansible playbooks, and Terraform configs between YAML and JSON, validating TOML configuration files before deployment, and beautifying generated configs for code review
QA EngineerValidating API response formats against expected structures, minifying test fixtures for storage efficiency, and converting test data between formats for cross-platform test suites
API IntegratorTransforming third-party API responses from JSON to YAML for internal documentation, converting CSV spreadsheets to JSON for programmatic consumption, and validating TOML configuration files for SDK integration
Technical WriterGenerating pretty-printed code samples in multiple formats for documentation, converting data examples between JSON and YAML for multi-format tutorials, and validating example data correctness
Security AnalystScanning YAML configuration files for duplicate key overrides, validating JSON payloads for structural integrity before security scanning, and converting CSV threat intel feeds to structured formats

Why use this?

  • Four formats, one tool. Most converters handle JSON-to-YAML or JSON-to-CSV in isolation. This actor covers all four format pairs β€” JSON, YAML, TOML, and CSV β€” in every combination. No more installing separate libraries or maintaining bespoke conversion scripts for each pair.

  • Four operation modes, not just conversion. Beyond convert, the actor offers validate (deep structural analysis with actionable error messages), beautify (consistent pretty-printing with controlled indentation), and minify (compact output for storage and transmission). One actor replaces an entire toolbox.

  • Deep validation catches what syntax checkers miss. Standard parsers tell you whether data is syntactically valid. This actor also detects duplicate JSON keys at any nesting depth, YAML merge-key overrides, TOML dotted-key conflicts, CSV row-length inconsistencies, and tab-indentation in YAML. These are real-world issues that cause silent data corruption in production pipelines.

  • Batch processing with independent error isolation. Process up to 20 items in a single run. Each item is processed independently β€” one invalid document never blocks the rest. Perfect for bulk ETL, configuration file migrations, and regression test suites where you need to convert or validate dozens of files at once.

  • Deterministic, idempotent output. Given the same input and parameters, the actor always produces identical output. No randomness, no server-side state, no hidden transformations. This matters for CI/CD pipelines, regression testing, and any workflow where repeatability is a requirement.

  • Zero external dependencies, no data leakage. The actor runs entirely inside Apify's secure execution container with no outbound HTTP calls. Your data is parsed, converted, and returned β€” it is never stored, logged, or transmitted to any third party. Sensitive configuration files and proprietary data remain fully under your control.

Features

  1. Multi-format bidirectional conversion β€” Convert between any pair of JSON, YAML (1.2), TOML (v1.0), and CSV formats. All 12 directed conversion paths are supported (4 formats Γ— 3 targets each). Nested structures, arrays, and mixed types are preserved with format-appropriate serialization.

  2. Deep syntax validation with structured errors β€” Go beyond basic parse success/failure. The validator checks duplicate JSON keys at arbitrary depth, YAML merge-key conflicts, tab-indentation violations, TOML dotted-key collisions, and CSV row-length consistency. Each error includes a human-readable message you can act on immediately.

  3. Controlled pretty-printing (beautify mode) β€” Re-serialize any format with configurable indentation (0–16 spaces) and optional alphabetical key sorting. JSON output uses strict ECMA-404 formatting. YAML output uses block-scalar style with proper string quoting to prevent type coercion. TOML output uses canonical table ordering.

  4. Compact minification (minify mode) β€” JSON minification produces the smallest possible representation (no whitespace, compressed separators). For YAML, TOML, and CSV, minification removes unnecessary indentation while preserving structural validity. Ideal for reducing storage costs and optimizing API payload sizes.

  5. CSV with configurable delimiters and headers β€” Parse and generate CSV with custom delimiters (comma, semicolon, tab, pipe, or any single character). Toggle header row inclusion. Dict-based rows preserve key ordering. Multi-line cells are detected during validation. Export structured data to CSV for spreadsheet analysis or import CSV data into structured formats for programmatic processing.

  6. Batch mode with independent item processing β€” Submit up to 20 items in the batchData array. Each item specifies its own inputData, sourceFormat, and targetFormat. Items are processed sequentially with independent error handling β€” a failure in one item never cancels the others. Every result includes its own success status, parse time, and validation errors.

  7. Key sorting for consistent output β€” Enable sortKeys to produce alphabetically sorted object keys in JSON and YAML output. This is critical for diff-friendly output, reproducible builds, and configuration management where key ordering must be deterministic across runs.

  8. Input size guarding and preview β€” All inputs are limited to 1 MB per item, preventing resource exhaustion from oversized documents. Every result includes an inputPreview field showing the first 200 characters, making it easy to identify which input produced which output in batch results.

  9. Millisecond performance metrics β€” Every result includes parseTimeMs, giving you precise insight into processing duration. Individual conversions typically complete in under 50 ms for documents under 100 KB, making the actor suitable for latency-sensitive workflows.

  10. Charge events for transparent billing β€” Four distinct charge events (apify-actor-start, format-convert, batch-convert, deep-validate) provide granular visibility into usage costs. The charge_safe wrapper ensures a charge failure never aborts a successful conversion.

Input Parameters

FieldTypeRequiredDefaultDescription
inputDatastringYes*β€”The data source to convert, validate, beautify, or minify. Provide the raw string content in the format specified by sourceFormat. Maximum length: 1,000,000 characters.
sourceFormatstringYesjsonFormat of the input data. One of: json, yaml, toml, csv.
targetFormatstringYes**yamlTarget format for conversion. One of: json, yaml, toml, csv. Only used when mode is convert.
modestringNoconvertOperation mode. One of: convert, validate, beautify, minify.
batchDataarrayNo***[]Array of batch items for processing multiple inputs in one run. Each item supports inputData, sourceFormat, targetFormat. Maximum 20 items.
batchModebooleanNofalseEnable batch processing. When true, provide items in batchData instead of using inputData.
csvDelimiterstringNo,Delimiter character for CSV parsing and generation. Common values: , (comma), ; (semicolon), \t (tab), `
csvHasHeaderbooleanNotrueWhether the CSV data includes a header row. When true, the first row becomes dictionary keys.
indentSizeintegerNo2Number of spaces for indentation in pretty-printed output (0–16). Applied to JSON and YAML.
sortKeysbooleanNofalseSort object keys alphabetically in JSON and YAML output.

*Either use inputData for single mode, or enable batchMode with batchData for batch processing.
**Required when mode is convert. Ignored for validate, beautify, and minify modes.
***Required when batchMode is true. At least one item with non-empty inputData is needed.

Example Input

Convert JSON to YAML

{
"inputData": "{\"name\": \"Acme Corp\", \"version\": 2, \"active\": true, \"tags\": [\"production\", \"us-east\"], \"config\": {\"timeout\": 30, \"retries\": 3}}",
"sourceFormat": "json",
"targetFormat": "yaml",
"mode": "convert",
"indentSize": 2,
"sortKeys": false
}

Validate a YAML document

{
"inputData": "name: Acme Corp\nversion: 2\nactive: true\ntags:\n - production\n - us-east\n",
"sourceFormat": "yaml",
"mode": "validate"
}

Beautify a minified JSON string

{
"inputData": "{\"name\":\"Acme Corp\",\"version\":2,\"nested\":{\"key\":\"value\",\"list\":[1,2,3]}}",
"sourceFormat": "json",
"mode": "beautify",
"indentSize": 4,
"sortKeys": true
}

Minify a JSON string

{
"inputData": "{\n \"name\": \"Acme Corp\",\n \"version\": 2\n}",
"sourceFormat": "json",
"mode": "minify"
}

Convert CSV to JSON

{
"inputData": "name,version,active\nAcme Corp,2,true\nExample Inc,1,false\n",
"sourceFormat": "csv",
"targetFormat": "json",
"mode": "convert",
"csvDelimiter": ",",
"csvHasHeader": true
}

Batch mode β€” multiple conversions in one run

{
"batchMode": true,
"batchData": [
{
"inputData": "{\"id\": 1, \"name\": \"Alpha\"}",
"sourceFormat": "json",
"targetFormat": "yaml"
},
{
"inputData": "key: value\nnested:\n a: 1\n b: 2\n",
"sourceFormat": "yaml",
"targetFormat": "toml"
},
{
"inputData": "name,role\nAlice,Developer\nBob,Tester\n",
"sourceFormat": "csv",
"targetFormat": "json"
}
],
"mode": "convert",
"indentSize": 2
}

Output Format

Result fields

FieldTypeDescription
idintegerSequential item identifier (0-indexed). Always 0 for single mode.
sourceFormatstringOriginal format of the input data, as specified or inferred.
targetFormatstringTarget format after conversion. Same as sourceFormat for validate/beautify/minify modes.
modestringOperation performed: convert, validate, beautify, or minify.
inputPreviewstringFirst 200 characters of the original input for identification.
resultstringConverted, validated, beautified, or minified output. For validate mode, shows a summary or the prettified representation.
resultLengthintegerCharacter count of the result string.
isValidbooleanWhether the input passed validation. Always true for non-validate modes unless an error occurred.
validationErrorsarray of stringList of validation error messages. Empty array when input is valid.
parseTimeMsnumberProcessing duration in milliseconds (rounded to 1 decimal place).
errorstring or nullError message if processing failed. null on success.
successbooleantrue when the operation completed without errors.

Single convert result (JSON β†’ YAML)

{
"id": 0,
"sourceFormat": "json",
"targetFormat": "yaml",
"mode": "convert",
"inputPreview": "{\"name\": \"Acme Corp\", \"version\": 2, \"active\": true, \"tags\": [\"production\", \"us-east\"], \"config\": {\"timeout\": 30, \"retries\": 3}}",
"result": "name: Acme Corp\nversion: 2\nactive: true\ntags:\n - production\n - us-east\nconfig:\n timeout: 30\n retries: 3\n",
"resultLength": 105,
"isValid": true,
"validationErrors": [],
"parseTimeMs": 12.3,
"error": null,
"success": true
}

Validation result with errors

{
"id": 0,
"sourceFormat": "json",
"targetFormat": "json",
"mode": "validate",
"inputPreview": "{\"name\": \"Acme Corp\", \"version\": 2, \"name\": \"Duplicate\"}",
"result": "",
"resultLength": 0,
"isValid": false,
"validationErrors": [
"Duplicate JSON key: 'name'"
],
"parseTimeMs": 3.2,
"error": null,
"success": true
}

Batch result (2 items)

{
"id": 0,
"sourceFormat": "json",
"targetFormat": "yaml",
"mode": "convert",
"inputPreview": "{\"id\": 1, \"name\": \"Alpha\"}",
"result": "id: 1\nname: Alpha\n",
"resultLength": 17,
"isValid": true,
"validationErrors": [],
"parseTimeMs": 8.7,
"error": null,
"success": true
}

Followed by the second item. Each batch item is pushed as a separate dataset entry for independent consumption.

Use Cases

  • Configuration file migration β€” Convert a fleet of YAML configuration files to TOML or JSON when migrating between infrastructure tooling (e.g., Ansible to Terraform, Docker Compose to Kubernetes). Validate every converted file before deployment to catch structural issues early.

  • API response transformation β€” Receive JSON from a third-party API, convert it to YAML for internal documentation, or flatten nested JSON structures into CSV for business intelligence reporting. The actor handles type conversion and nested structure mapping automatically.

  • CI/CD pipeline data formatting β€” Integrate into build pipelines to format, validate, or minify configuration files before deployment. Use beautify mode to enforce consistent formatting standards across your codebase. Use minify mode to reduce artifact sizes.

  • Spreadsheet-to-structured-data ingestion β€” Parse CSV exports from Google Sheets, Excel, or Airtable and convert them to JSON or YAML for programmatic consumption. Configure custom delimiters for non-standard CSV formats (semicolon-separated, tab-separated).

  • Multi-format data normalization β€” Ingest data from multiple sources that each use different formats, normalize everything to a single target format, and validate consistency across sources. Batch mode processes all conversions in one run with independent error handling per source.

  • Security auditing of configuration files β€” Use validate mode to scan YAML and TOML configuration files for duplicate keys, merge-key overrides, or other structural anomalies that could indicate misconfiguration or malicious injection. Detect tab-indentation issues before they cause parser failures in production.

  • Documentation code sample generation β€” Generate consistent, properly-formatted code samples in JSON, YAML, and TOML for API documentation and developer guides. Use beautify mode with sorted keys to produce examples that are both readable and deterministic.

  • ETL data pipeline intermediate transformation β€” As part of a larger data processing pipeline, use the actor to transform data between formats at intermediate stages. The deterministic output ensures repeatable ETL runs, and the millisecond timing metrics help track pipeline performance.

FAQ

1. What formats are supported for conversion? JSON (ECMA-404), YAML (1.2 with SafeLoader), TOML (v1.0 via tomllib), and CSV (RFC 4180 with configurable delimiters). All 12 directed conversion paths between these four formats are supported.

2. What is the maximum input size? Each item is limited to 1,000,000 characters. For batch mode, up to 20 items are supported per run. Inputs exceeding the size limit will trigger a validation error.

3. Does the actor make any external API calls? No. The actor is entirely self-contained. All parsing, conversion, and validation runs locally inside the Apify execution container. There are zero outbound HTTP calls β€” your data is never sent to any external service.

4. How are CSV files with custom delimiters handled? Use the csvDelimiter parameter to specify any single character delimiter. Common choices include comma (,), semicolon (;), tab (\t), and pipe (|). The csvHasHeader parameter controls whether the first row is treated as column names.

5. What happens if conversion fails for one item in batch mode? Each batch item is processed independently. A failure in one item produces an error result for that item only β€” all other items are processed normally. Every result includes a success boolean and an error string for individual status checking.

6. Does the actor handle deeply nested JSON objects? Yes. The parser handles arbitrary nesting depth within available memory limits. Nested objects and arrays are preserved during conversion with format-appropriate serialization (YAML block-nesting, TOML table arrays, CSV flattened representation).

7. What does validate mode check beyond basic syntax? Validate mode performs deep structural analysis: duplicate JSON keys at any nesting depth, YAML merge-key conflicts, tab-indentation in YAML, TOML dotted-key collisions, CSV row-length consistency, multi-line cell detection, encoding validation, and type consistency warnings.

8. Can I sort object keys in the output? Yes. Set sortKeys: true to produce alphabetically sorted object keys in JSON and YAML output. This is useful for diff-friendly, deterministic output across repeated runs. TOML and CSV output ordering is determined by the input structure.

9. What is the difference between beautify and minify modes? Beautify re-serializes data with controlled indentation (configurable via indentSize) and optional key sorting. Minify produces the most compact representation β€” JSON output has no whitespace, YAML/TOML/CSV output uses zero indentation. Both modes validate the input first.

10. Is the actor suitable for use in CI/CD pipelines? Yes. The actor is fully callable via the Apify API, returns deterministic output, has configurable timeouts (default 300s, configurable up to the platform limit), and uses charge-safe billing that never aborts on charge failure. The structured output with success flags and parse-time metrics makes it straightforward to integrate into automated workflows.

11. How is TOML serialization handled? TOML output uses the tomli_w library for standards-compliant serialization following the TOML v1.0 specification. Tables are serialized in key-insertion order, arrays of tables use the [[array]] syntax, and inline tables are used where appropriate. Non-dictionary root values are wrapped in a value key.

12. What happens if my CSV data has inconsistent row lengths? The validator detects and reports row-length inconsistencies. During conversion, missing values are rendered as empty strings and extra values are appended. The csvHasHeader parameter controls whether the first row defines column names β€” without it, auto-generated keys (col_0, col_1, etc.) are used.

Usage & Billing

This actor uses event-based billing with four charge events. Each event is charged only when the corresponding operation occurs. The charge_safe wrapper ensures that a charge failure never aborts your conversion β€” results are always returned.

EventPriceTrigger
apify-actor-start$0.005Charged once at the start of every actor run
format-convert$0.01Charged per successful single conversion (mode: convert)
batch-convert$0.008Charged per batch item processed (mode: convert with batchMode: true)
deep-validate$0.005Charged per successful validation run (mode: validate)

Cost examples:

  • Single conversion (JSON β†’ YAML): 1 Γ— apify-actor-start ($0.005) + 1 Γ— format-convert ($0.01) = $0.015
  • Single validation (YAML document): 1 Γ— apify-actor-start ($0.005) + 1 Γ— deep-validate ($0.005) = $0.01
  • Batch of 10 conversions: 1 Γ— apify-actor-start ($0.005) + 10 Γ— batch-convert ($0.008) = $0.085
  • Beautify or minify: 1 Γ— apify-actor-start ($0.005) β€” beautify and minify modes do not trigger format-convert or validate charges

Platform-level Apify compute and storage charges apply separately based on your Apify plan. See the Apify pricing page for current platform rates.

MCP Integration

Use this actor directly from MCP-compatible environments such as Claude Code, Cursor, or any tool with the Apify MCP server configured.

Single conversion via MCP

{
"input": {
"inputData": "{\"name\": \"Acme Corp\", \"version\": 2}",
"sourceFormat": "json",
"targetFormat": "yaml",
"mode": "convert"
}
}

Batch validation via MCP

{
"input": {
"batchMode": true,
"batchData": [
{
"inputData": "{\"id\": 1, \"status\": \"active\"}",
"sourceFormat": "json",
"targetFormat": "yaml"
},
{
"inputData": "name: Test\nversion: 1.0\n",
"sourceFormat": "yaml",
"targetFormat": "json"
}
],
"mode": "convert"
}
}

MCP Integration

This actor can be used as a tool inside any MCP-compatible AI client (Claude Desktop, Cursor, VS Code with Copilot) via the Apify MCP server.

Quick Start

  1. Ensure your MCP client is configured to use the Apify MCP server:
{
"mcpServers": {
"apify": {
"url": "https://mcp.apify.com"
}
}
}

On first connection, your browser will open to sign in to Apify and authorize access.

  1. Ask your AI assistant to convert data between formats. Example prompts:

"Convert this JSON to YAML: {"name": "Acme Corp", "version": 2, "active": true}"

"Validate the following TOML file for syntax errors: [server]\nhost = "localhost"\nhost = "example.com""

Bearer Token Alternative

For headless environments (CI/CD, VS Code without browser-based OAuth), configure with a personal API token:

{
"mcpServers": {
"apify": {
"url": "https://mcp.apify.com",
"headers": {
"Authorization": "Bearer YOUR_APIFY_TOKEN"
}
}
}
}

Note: The OAuth flow is recommended for security. API tokens should be treated as secrets and never committed to version control.

  • JSON Studio β€” Format, validate, diff, transform, and explore JSON documents with 8 operation modes
  • Regex Lab β€” Design, test, and debug regular expressions with visual matching and batch processing
  • Diff Tool β€” Compare two texts, URLs, or files for differences with structured output
  • Mock Data Generator β€” Generate realistic mock data in JSON, CSV, and SQL formats for testing and development
  • SQL Formatter & Query Analyzer β€” Format, validate, and analyze SQL queries with execution plan insights