JSON to CSV, Minus the Spreadsheet Cleanup

Dumping an API response straight into Excel always ends the same way: hundreds of irrelevant columns, duplicate rows, and half an hour of manual cleanup. Do the shaping before the CSV exists.

One command, shaped output

Take a raw export like orders.json and keep only what the spreadsheet actually needs:

$ transmute orders.json --pipe '[
  {"op":"filter","expr":"item.status === \"shipped\""},
  {"op":"pick","fields":["id","customer","total"]},
  {"op":"sort","by":"total","dir":"desc"}
]' --output csv
id,customer,total
1039,Cara Vind,2199.99
1042,Alice Hansen,1299

What each step removed from the cleanup session:

  • filter — no more hiding cancelled orders in Excel filters
  • pick — the sheet gets exactly the columns you chose, in order
  • sort — highest value first, before anyone opens it

Deduplicating before import

Re-running exports tends to duplicate rows. Dedupe by a business key on the way through:

$ cat customers.json | transmute --pipe '[{"op":"unique","by":"email"}]' --output csv

Nested data

CSV is flat. Flatten nested objects deliberately with map rather than hoping a generic flattener guesses right:

$ transmute users.json --pipe '[
  {"op":"map","expr":"({ name: item.name, city: item.address.city })"}
]' --output csv

No Node installed?

The desktop app runs the same engine without a terminal: open the file, add the same steps, copy the CSV out. Nothing leaves your machine either way.