cURL to JSON Converter
Convert cURL commands to structured JSON objects instantly. Parse headers, body, auth, cookies, and options from any cURL syntax.
Your JSON output will appear here...
About
cURL commands encode HTTP request semantics in a dense, flag-heavy shell syntax. A misread -H flag or a dropped --data-raw payload during manual translation into application code causes silent API failures - wrong Content-Type, missing auth headers, truncated bodies. This converter parses the full cURL argument grammar including shell quoting rules, backslash line continuations, and flag aliases, then emits a clean JSON object you can directly feed into fetch(), Axios, or any HTTP client config. It handles implicit method detection: if --data is present but no -X flag, the method resolves to POST per cURL specification. Limitations: this tool does not resolve environment variables ($VAR) or execute sub-shells ($(cmd)). Glob patterns and --config file references are ignored.
Formulas
The parser operates as a two-stage pipeline. Stage 1 is shell tokenization. Stage 2 is flag-to-field mapping.
Tokenization splits the raw cURL string respecting shell quoting rules. Single-quoted strings ("...") preserve all characters literally. Double-quoted strings ("...") allow backslash escapes (\", \\, \n). Backslash-newline sequences (\ followed by newline) are treated as line continuations and removed.
Method resolution follows cURL precedence: explicit -X wins. If absent and -I/--head is set, method = HEAD. If -d/--data/-F is present and no -G, method = POST. Otherwise method = GET. When -G is set, any -d data is appended to the URL as query parameters instead of being sent as body.
Where url = the target endpoint, method = HTTP verb, headers = key-value map of request headers, body = request payload (string or structured object), auth = authentication credentials object, cookies = parsed cookie key-value pairs, options = behavioral flags (redirects, timeouts, TLS settings).
Reference Data
| cURL Flag | Alias | JSON Field | Description |
|---|---|---|---|
| -X | --request | method | HTTP method (GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS) |
| -H | --header | headers | Request header in Key: Value format |
| -d | --data | body | Request body (URL-encoded by default) |
| --data-raw | - | body | Request body sent without special interpretation |
| --data-binary | - | body | Binary data body (preserves newlines) |
| --data-urlencode | - | body | URL-encodes the data value |
| -F | --form | body / multipart | Multipart form data field |
| -u | --user | auth | Basic auth credentials user:password |
| -A | --user-agent | headers["User-Agent"] | Sets User-Agent header |
| -e | --referer | headers["Referer"] | Sets Referer header |
| -b | --cookie | cookies | Send cookies (name=value; name2=value2) |
| --compressed | - | options.compressed | Requests compressed response (adds Accept-Encoding) |
| -k | --insecure | options.insecure | Skip TLS certificate verification |
| -L | --location | options.followRedirects | Follow HTTP redirects |
| --connect-timeout | - | options.connectTimeout | Connection timeout in seconds |
| --max-time | -m | options.maxTime | Maximum total request time in seconds |
| -I | --head | method โ HEAD | Fetch headers only (sets method to HEAD) |
| -G | --get | method โ GET | Forces GET even if -d is present (appends data as query string) |
| --url | - | url | Explicit URL (alternative to positional argument) |
| -o | --output | options.output | Write output to file (informational only) |
| -s | --silent | options.silent | Silent mode (suppress progress meter) |
| -v | --verbose | options.verbose | Verbose output mode |