Skip to content
koducathome

cURL to Julia Converter

Convert curl commands to Julia code using HTTP.jl. Paste a command and the Julia 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 Julia HTTP.jl code appears instantly.
  3. Set up: Install it with import Pkg; Pkg.add("HTTP").
  4. Run it: Run the script with julia request.jl. Replace placeholders such as YOUR_TOKEN first, and check any notes under the editors for curl options that have no HTTP.jl equivalent.

Example

GET with headers → Julia HTTP.jl

curl command
curl 'https://api.example.com/v1/users?page=2' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_TOKEN'
Julia HTTP.jl
using HTTP

url = "https://api.example.com/v1/users?page=2"
headers = [
    "Accept" => "application/json",
    "Authorization" => "Bearer YOUR_TOKEN",
]

response = HTTP.request("GET", url, headers; status_exception = false)

println(response.status)
println(String(response.body))

Common use cases

  • Loading data from APIs into Julia
  • Scientific workflows that call web services

Converting curl to Julia HTTP.jl

HTTP.jl is Julia's main HTTP client and server package.

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 HTTP.jl code. Options that have no HTTP.jl 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

Why status_exception = false?

So 4xx/5xx responses are returned instead of throwing, matching curl.

How do I parse a JSON response?

Use JSON3.jl or JSON.jl, e.g. JSON3.read(response.body).

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.