Translating data between formats is one of those tasks that sounds simple but always has a catch — nested arrays that don't map cleanly, YAML indentation that breaks, or CSV columns that need renaming. Claude handles the edge cases so you don't have to.
Convert this JSON to YAML. Preserve all nested structures and use 2-space indentation.
[paste your JSON]
It works the other way too — and across more format pairs than any single CLI tool:
Convert this CSV to a JSON array of objects, using the header row as keys.
Clean up any whitespace in the values.
[paste your CSV]
For larger files, pipe directly from the terminal:
cat config.json | claude -p "Convert this to TOML format"
cat data.yaml | claude -p "Convert to a flat CSV. Use dot notation for nested keys."
You can also transform the data during conversion:
Convert this JSON array to CSV. Only include the `id`, `name`, and `email` fields.
Rename `name` to `full_name` in the output headers.
Claude handles YAML multi-line strings, JSON with comments (JSONC), XML attributes vs elements, and other format quirks that break naive converters.
Whatever format the data came in, Claude can get it to the format you need.
Log in to leave a comment.
Before asking Claude to scaffold a new feature, point it at your existing code first — it will match your naming, structure, error handling, and test patterns exactly rather than defaulting to framework boilerplate.
Give Claude the full picture upfront before it writes any code, so it builds the right thing the first time with fewer correction rounds.
Complex prompts are unreadable as escaped single-liners. Use shell HEREDOCs to write clean, structured prompts directly in your scripts.