Data Conversion Cheat Sheet: CSV, JSON, YAML, XML

Utilko Team 5 min read Developer

The Four Primary Data Serialization Formats

Modern applications need to exchange structured data. The four dominant formats each have distinct strengths: CSV for tabular data, JSON for hierarchical API data, YAML for human-readable configuration, and XML for document-oriented and enterprise data. Converting between them is a daily developer task.

CSV (Comma-Separated Values)

Best for: Tabular data (spreadsheets, database exports, reports). Every row is a record; every comma separates a field. Readable in any spreadsheet application, easily imported into databases. Limitations: no data types (everything is text), no nesting, no support for multi-line values without quoting.

Example:

name,age,city
Alice,30,New York
Bob,25,London

Convert CSV to JSON here.

JSON (JavaScript Object Notation)

Best for: REST API request/response bodies, web application configuration, data interchange between services. Supports nesting, arrays, and basic data types (string, number, boolean, null). Native to JavaScript but used universally. Limitations: no comments, verbose for tabular data, no date type.

Convert JSON to CSV | JSON to YAML | JSON to XML

YAML (YAML Ain't Markup Language)

Best for: Configuration files (Docker Compose, Kubernetes, GitHub Actions, CI/CD pipelines, Ansible). Uses indentation instead of brackets, making it the most human-readable format. Supports comments (unlike JSON). Limitations: indentation sensitivity causes bugs, complex objects can be confusing. Convert JSON to YAML here.

XML (eXtensible Markup Language)

Best for: Document-oriented data, enterprise integrations (SOAP APIs, SAML, RSS feeds, SVG), data formats requiring schemas (XSD validation). Supports attributes and text content within the same element. Limitations: very verbose, harder to read than JSON or YAML. Convert JSON to XML here.

Quick Conversion Decision Guide

  • Spreadsheet data → API → CSV to JSON
  • API response → spreadsheet analysis → JSON to CSV
  • API config → Kubernetes manifest → JSON to YAML
  • Legacy system integration → JSON to XML

Common Pitfalls

Date handling: All three formats handle dates differently. JSON has no native date type — dates are typically strings (ISO 8601: "2026-04-03T10:30:00Z"). YAML has a native date type. XML uses xs:date in schemas.

Character encoding: Always use UTF-8. Mismatched encodings cause garbled special characters, especially in non-Latin scripts.

Large files: For files over 100 MB, browser-based converters may be slow. Consider command-line tools (jq, csvkit, yq) for large datasets.

Tools Mentioned in This Article