How to convert data formats in code

Convert structured data between JSON, CSV, TSV, YAML, and XML from any language by POSTing to a single endpoint. Examples below.

curl

curl -X POST "https://data.wrapper-agency.com/api/v1/convert" \
  -H "Content-Type: application/json" \
  -d '{"from":"json","to":"yaml","data":"{\"hello\":\"world\"}"}'

JavaScript (fetch)

const res = await fetch("https://data.wrapper-agency.com/api/v1/convert", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    from: "csv",
    to: "json",
    data: "id,name\n1,Ada\n2,Alan",
  }),
});
const { output } = await res.json();
console.log(output);

Python (requests)

import requests

r = requests.post(
    "https://data.wrapper-agency.com/api/v1/convert",
    json={
        "from": "yaml",
        "to": "json",
        "data": "name: Ada\nrole: Engineer",
    },
)
print(r.json()["output"])

Notes

See the full API reference, or try a conversion on any of the format pages.