Skip to content
koducathome

cURL to JSON Converter

Convert curl commands to JSON code using request object. Paste a command and the JSON snippet appears instantly — everything runs in your browser.

How to use this tool

Steps for using the cURL to Code.

  1. Copy a curl command — from API documentation, or from your browser's DevTools (Network tab → right-click a request → Copy as cURL (bash)).
  2. Paste it into Enter cURL command. The JSON request object code appears instantly.
  3. Set up: No setup — the output is JSON.
  4. Run it: Save it as request.json and load it from your own scripts or tests. Replace placeholders such as YOUR_TOKEN first, and check any notes under the editors for curl options that have no request object equivalent.

Example

GET with headers → JSON request object

curl command
curl 'https://api.example.com/v1/users?page=2' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_TOKEN'
JSON request object
{
  "url": "https://api.example.com/v1/users",
  "raw_url": "https://api.example.com/v1/users?page=2",
  "method": "get",
  "headers": {
    "Accept": "application/json",
    "Authorization": "Bearer YOUR_TOKEN"
  },
  "queries": {
    "page": "2"
  }
}

Common use cases

  • Storing requests as test fixtures
  • Feeding requests into your own tooling
  • Comparing two curl commands

Converting curl to JSON request object

The JSON request object describes the request — URL, method, headers, query and body — as plain JSON, so other tools and tests can read it.

The converter reads the curl command the way curl does — the method (-X), headers (-H), request bodies (-d, --data-raw, --json, -F), query strings, basic auth (-u) and cookies — and writes the equivalent request object code. Options that have no request object equivalent are listed under the editors rather than silently dropped.

Limitations

  • The code is a starting point: add timeouts, retries and error handling for production use.
  • Secrets in the curl command are copied into the code — move them to environment variables before committing.

Frequently asked questions

Is this a standard format?

It's a simple description of the request, not an official standard. For a standard format, use HAR.

Why is the body parsed into JSON?

When the curl body is valid JSON, it's included as an object so you can read fields directly.

Is my curl command sent to a server?

No. The conversion runs entirely in your browser, so tokens and passwords in the command never leave your device. Still, replace real secrets before sharing the generated code.