cURL to fetch / axios
Turn terminal commands into JavaScript code.
Why convert cURL
cURL commands are the lingua franca of API docs — every reference shows a copy-paste cURL example. But your app speaks JavaScript. This converter translates the parts that matter: the URL, method, headers (including Authorization), and the request body — turning quoted JSON into a real JS object literal so you can edit it afterwards.
Multi-line commands with backslashes paste in cleanly, and both single-quoted shells strings and double-quoted Windows-style arguments are handled. Authentication with -u user:pass becomes the Basic Authorization header, the same wire format the browser would send.
FAQ
What flags are supported?
-X/--request, -H/--header, -d/--data (incl. --data-raw, --data-urlencode), -u/--user, -L/--location (converted to redirect: 'follow', the default), and bare URLs. Uncommon flags are ignored rather than guessed.
Should I remove the Authorization header before sharing the output?
Yes — tokens in docs and tickets leak constantly. Replace them with a placeholder before committing the generated code.