Skip to content
OddsockLocal
Local
Source text
Output languagefetch
ReadyRuns in this browser. Nothing is uploaded.

How to use

  1. Paste one curl command. Quote the URL and the header values.
  2. Choose Output language: fetch, axios, python, go, php, httpie or curl.
  3. Copy the snippet. Nothing is requested from the host.
  4. If the page names an unsupported option, drop that flag or build the call on the request builder instead.

What is cURL converter?

Curl converter starts from a command you already have, which is the opposite of the builders. Paste curl 'https://example.test/api' -H 'Content-Type: application/json' --data-raw '{"name":"Sam"}' and set Output language to fetch. You get an await fetch() call with method POST, the content-type header, and the JSON text as the body. The same command can be rewritten as Axios, Python requests, Go, PHP or HTTPie.

Read more

The command is parsed, not executed. A file reference such as -d @notes is refused, because reading a local file would turn a converter into something that touches your disk. Shell substitutions, pipes and redirections are refused for the same reason: only literal arguments are accepted. Unsupported flags fail with the flag named.

One URL per command. If you pass a body and no Content-Type, the converter adds application/x-www-form-urlencoded, matching curl’s own default for -d. --data-raw does not get that treatment from a leading @, but a missing content type still follows the body rule when the body is literal data.

Use cases

  • A browser ticket includes a curl you copied from DevTools and the backend developer wants the same call as Python requests.
  • You inherited a bash snippet and need HTTPie for a runbook that the on-call already knows.
  • A review checks that the curl does not hide a shell expansion before anyone runs it.
  • Someone wants fetch, and the only source of truth is a curl line in an old README.

A curl POST rewritten as fetch

curl 'https://example.test/api' -H 'Content-Type: application/json' --data-raw '{"name":"Sam"}', output language fetch.

const response = await fetch("https://example.test/api", { method: "POST", headers: { "content-type": "application/json" }, body: "{\"name\":\"Sam\"}" }); console.log(await response.text());

Why use Oddsock

Refusing @file and $variables keeps the page a translator. It will not quietly read a notes file or expand a secret from the shell.

Related tools

Using this tool

No. The command is parsed into a URL, method, headers and body, then printed in another language. The host is not contacted.