cURL to Clojure Converter
Convert curl commands to Clojure code using clj-http. Paste a command and the Clojure snippet appears instantly — everything runs in your browser.
- Instant ConversionCode updates as you type
- Multiple Languages40 languages, 61 libraries
- 100% Client SideYour data stays private
How to use this tool
Steps for using the cURL to Code.
- Copy a curl command — from API documentation, or from your browser's DevTools (Network tab → right-click a request → Copy as cURL (bash)).
- Paste it into Enter cURL command. The Clojure clj-http code appears instantly.
- Set up: Add
clj-http(andcheshirefor JSON bodies) to yourdeps.ednorproject.cljdependencies. - Run it: Evaluate the code in a REPL, or run it as a script with the dependencies on the classpath. Replace placeholders such as
YOUR_TOKENfirst, and check any notes under the editors for curl options that have no clj-http equivalent.
Example
GET with headers → Clojure clj-http
curl 'https://api.example.com/v1/users?page=2' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer YOUR_TOKEN'(require '[clj-http.client :as client])
(def response
(client/request
{:method :get
:url "https://api.example.com/v1/users?page=2"
:headers {"Accept" "application/json"
"Authorization" "Bearer YOUR_TOKEN"}
:throw-exceptions false}))
(println (:status response))
(println (:body response))Common use cases
- Clojure services and data pipelines
- REPL exploration of an API
Converting curl to Clojure clj-http
clj-http is a widely used Clojure HTTP client built on Apache HttpClient. JSON bodies are encoded with cheshire when :content-type :json is set.
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 clj-http code. Options that have no clj-http 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 do I need cheshire?
clj-http uses cheshire to turn Clojure maps into JSON when :content-type :json is set.
Why :throw-exceptions false?
So 4xx and 5xx responses are returned like curl returns them, instead of throwing.
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.