curl to code
Turn a curl command into fetch, Python, Go or PowerShell
JavaScript
Paste a curl command above to see it as JavaScriptWhat this tool does and does not do
- The command is split the way a shell splits words — single quotes, double quotes with backslash escapes, $'…' quoting, and the POSIX \, PowerShell ` and cmd ^ line continuations. It is not a shell: variables, globs, command substitution and ~ are not expanded, so $TOKEN stays the literal text $TOKEN.
- Nothing is requested. This is a text-to-text conversion; the site makes no network calls, so the generated code is never run and no URL in it is ever contacted.
- A body read from a file (-d @payload.json) cannot be inlined, since the file is not readable from a browser tab. A placeholder goes in its place.
- Only the first URL is used. curl accepts several and requests each in turn; four snippets in a row is not what anyone means by this.
- Credentials from -u are written into the snippet as you pasted them. Move them to an environment variable or a secret store before the code goes anywhere.