>_ MoriDev dev.moritools.com
Fetch · Axios · Py 100% Client-Side · Zero Upload

cURL to Fetch / Axios / Python Requests Converter

Translate raw shell cURL commands (-X, -H, -d, --data-raw, --json, -u, -b) into clean Fetch, Axios, and Python Requests code.

Ready (Offline)
Quick Summary

Paste any multi-line cURL snippet from Chrome DevTools or Stripe/OpenAI docs—even ones containing live Authorization headers—to generate ready-to-run JavaScript fetch(), Axios, and Python requests code offline.

API reference pages and browser Network panels export requests as shell-escaped cURL commands loaded with backslash line continuations, single-quoted JSON bodies, and bearer tokens. Rewriting those flags by hand into fetch() or Python requests invites missing Content-Type headers and mangled quotes.

This shell-aware tokenizer handles POSIX single/double quotes and line continuations, decodes -X, -H, -d, --data-raw, --json, -u Basic Auth, -b cookies, and -G query-mode flags, and reads the Content-Type to emit idiomatic JSON.stringify() or Python json= arguments.

cURL Translation Pitfalls That Cause 400/415 Errors

01. Implicit POST When -d Is Present Without -X

cURL automatically switches the HTTP method from GET to POST whenever -d or --data-raw is supplied without an explicit -X verb—unless -G (--get) appends the data to the query string instead.

02. Forgetting Content-Type: application/json on Raw Strings

cURL -d defaults to application/x-www-form-urlencoded unless -H "Content-Type: application/json" or --json is specified. Fetch defaults string bodies to text/plain, triggering 415 Unsupported Media Type on strict APIs.

03. Double-Encoding JSON Bodies in Axios vs Fetch

Fetch requires body: JSON.stringify(obj), whereas Axios and Python requests(json=payload) serialize plain objects automatically. Passing a pre-stringified JSON string to Python json= double-quotes the payload.

Supported cURL Flags Mapping

cURL Flag Meaning Generated Output
-X / --request Explicit HTTP method method: "PATCH" / requests.patch(...)
-H / --header Request HTTP header pair Merged into headers object
-d / --data-raw / --json Request payload body Auto-parsed JSON object or raw string body
-u / --user HTTP Basic credentials (user:pass) Encoded into Authorization: Basic header
-b / --cookie Cookie header string Mapped to Cookie header entry
-G / --get Moves -d fields into URL query string Appended to target URL as GET request

Worked Engineering Examples

Converting a JSON POST With Bearer Auth

Input
curl -X POST https://api.example.com/jobs -H 'Authorization: Bearer tok_123' -H 'Content-Type: application/json' -d '{"queue":"emails"}'
Output
await fetch("https://api.example.com/jobs", { method: "POST", headers: {...}, body: JSON.stringify({ queue: "emails" }) })

Automatically detects the JSON body and formats nested headers cleanly across Fetch, Axios, and Python.

Handling -G Query Parameter Injection

Input
curl -G https://api.example.com/logs -d 'level=error' -d 'limit=50'
Output
GET https://api.example.com/logs?level=error&limit=50

Joins multiple -d arguments with & and appends them to the URL rather than sending an illegal GET body.

Frequently Asked Questions

Is it safe to paste cURL commands copied from DevTools that include cookies or Bearer tokens?

Yes. Parsing and code generation run entirely inside your local browser tab without sending the cURL string or credentials over the network.

Does it support multi-line cURL commands with trailing backslashes?

Yes. POSIX backslash-newline continuations are normalized automatically before tokenizing arguments.

Why does Python output map true/false/null to True/False/None?

JSON boolean and null keywords are lowercase, which would raise NameError in Python. The Python emitter rewrites them into native Python dict literals for requests.post(..., json=payload).

Can I switch between Fetch, Axios, and Python without re-pasting?

Yes. All three snippets are generated simultaneously—use the language tabs to inspect or copy whichever client library your repo uses.

Continue Your Workflow

24 offline developer utilities