JSON to cURL Command Generator
Build a ready-to-run curl (or wget) request from your JSON: method, URL, headers, Bearer token — copy, paste into the terminal, done.
curl -X POST -L 'https://api.example.com/v1/orders' \
-H 'Content-Type: application/json' \
-d '{
"customer": "ACME GmbH",
"items": [ { "sku": "KB-42", "qty": 2 } ],
"express": true
}'The anatomy of a JSON request with curl
Three things make a JSON API call work: the right method (-X POST), the Content-Type: application/json header, and a correctly quoted body (-d '…'). Most "my curl doesn't work" moments are one of these three — usually the missing Content-Type, which makes servers read the body as form data. This generator always emits all three correctly, plus your extra headers and auth, with bash-safe single-quote escaping.
Quoting: why single quotes, and what about Windows?
JSON is full of double quotes, so wrapping the body in single quotes means nothing inside needs escaping — the command stays readable. That works in every POSIX shell, Git Bash, WSL, macOS and PowerShell 7. Two Windows caveats worth knowing: classic cmd.exe understands only double quotes (escape inner ones as \"), and in Windows PowerShell 5.1 curl is an alias for Invoke-WebRequest — type curl.exe to get the real thing.
curl or wget?
For API work, curl is the standard — richer flags, --json shorthand in newer versions, ubiquitous in docs. The wget tab exists for the environments where wget is all you have (minimal containers, old servers): same request, expressed with --header/--post-data, streaming the response to stdout via -O-. And if someone hands you a curl command and you want the payload back out of it — paste it into the JSON Formatter, which detects curl/wget commands and extracts the JSON body in one click.
Frequently asked questions
Why does the command set Content-Type: application/json?
Without it, curl sends -d bodies as application/x-www-form-urlencoded and many APIs reject or misparse the payload. Explicitly declaring JSON is the single most common fix for "my curl POST does not work". (curl 7.82+ has --json which does the same implicitly.)
Will the generated command work on Windows?
In Git Bash, WSL and PowerShell 7 (which ships real curl as curl.exe): yes, as-is. In classic cmd.exe the single-quote style does not work — cmd needs double quotes with escaped inner quotes. In Windows PowerShell 5.1, "curl" is an alias for Invoke-WebRequest; call curl.exe explicitly.
How do I send the JSON from a file instead of inline?
Replace the inline -d body with -d @payload.json — the @ prefix tells curl to read the body from a file. Tip: with --data-binary @file the content is sent byte-for-byte; plain -d strips newlines.
What is the difference between the curl and the wget output?
Same request, different tool. wget needs --method/--body-data for anything beyond POST, follows redirects by default, and -O- streams the response to stdout. curl is the de-facto standard for API work; the wget variant exists for minimal environments where only wget is installed.
Is my token or payload sent anywhere when I use this page?
No. The command is assembled entirely in your browser — nothing you type here leaves your machine. The generated text is just that: text, until you run it in your own terminal.