Back to Tools

Code to Curl Converter

Generate a cURL command from a JSON Request configuration.

Input Data

Build a cURL command from a request description

Sharing an API call with a teammate is easier when it is a single terminal command. This tool takes a small JSON description of a request and writes the equivalent cURL command for you, so you do not have to remember the flag order or hand-quote a JSON body. It is useful when you already have the request in structured form, for example from a config file or a test fixture.

The input format

The input box expects one JSON object with these keys:

  • url - the endpoint address. If you leave it out, the tool falls back to a placeholder example.com address.
  • method - GET, POST, PUT and so on. It is converted to upper case, and GET is used when the key is missing.
  • headers - an object of header names and values, each of which becomes a separate -H argument.
  • body - either an object, which is converted to compact JSON text, or a plain string, which is used as written. It is added as a -d argument.

How to generate the command

  1. Paste your JSON into Input Data, or press Sample to load an example POST to a users endpoint with two headers and a small body.
  2. Press Process Now.
  3. The output panel shows the generated command and a note that it was generated. If your JSON is malformed you will see an error asking you to follow the sample format.
  4. Choose Copy to place the command on your clipboard or Download to save it as result.txt.

Practical scenarios

  • Reproducing a failing request in a bug report so that a backend developer can run it directly.
  • Turning a request from an API test suite into a one-liner for documentation.
  • Generating a quick smoke-test command for a staging endpoint during deployment checks.

Limits worth knowing

The generator handles only the four keys above. It does not add options such as basic auth, cookies, file uploads, form fields, query-string building or redirect following, so add those flags yourself after copying. Values are inserted as they are, without escaping, so a body that contains a single quote or a header value with a double quote needs manual quoting before you run the command. Also review the output before pasting it into a terminal, particularly the way the header and body arguments are joined, because shells differ in how they treat line continuations. Be careful with real credentials: an Authorization header in the config will appear in the command text and in your shell history once you run it.

Related Articles

Related Tools







Frequently Asked Questions

Which JSON keys does the tool read?
It reads url, method, headers and body. Other keys are ignored. A missing url becomes a placeholder example.com address and a missing method becomes GET, so include the fields you care about explicitly.
Can I pass the body as an object?
Yes. An object body is converted to compact JSON text and wrapped in single quotes after -d. A string body is used exactly as written, which is handy for form-encoded or raw text payloads.
Does it support basic auth, cookies or file uploads?
Not directly. Only headers and a body are translated. You can place an Authorization or Cookie value in the headers object, but flags such as -u, -F or -L must be added by hand after you copy the command.
Why does my command break when the body contains an apostrophe?
The body is placed inside single quotes without escaping, so an apostrophe ends the quoted string early. Edit the generated command to escape it for your shell, or restructure the data so the apostrophe is not needed.
Is the conversion done on a server?
No form is submitted. The command is built by JavaScript running in your browser page from the JSON you typed, and the Copy and Download buttons work on the text shown in the output panel.
Support Chat
We typically reply within minutes

Hello! 👋 Before we start, please tell us your name.