Skip to content
Shrake DevTools
  • JSON FormatterData & Format
  • JSON ValidatorData & Format
  • JSON MinifierData & Format
  • JSON ↔ YAML ConverterData & Format
  • XML FormatterData & Format
  • Base64 Encoder / DecoderData & Format
  • URL Encoder / DecoderData & Format
  • JWT InspectorData & Format
↑ ↓ to navigate↵ to openEsc to close

cURL → Java

Runs locally in your browser. Your input is not uploaded.Free, no sign-up

cURL command

Java

Convert cURL commands to Java HttpClient, Spring RestClient or WebClient code.

How to use the cURL to Java converter

  1. Paste a curl command (from API docs, Postman or your browser's Copy as cURL), or click Sample.
  2. Choose the Java client you use; the code updates instantly.
  3. Copy it into your project. Imports are included.

Which client?

  • Java 11+ HttpClient (java.net.http): built into the JDK, no dependencies. Good for plain Java, scripts and libraries.
  • Spring RestClient: the modern, fluent synchronous client in Spring Framework 6.1+ (Spring Boot 3.2+), the successor to RestTemplate.
  • Spring WebClient: reactive and non-blocking, for WebFlux applications. The sample blocks at the end for simplicity.

What's translated

  • Headers, JSON and raw bodies (as text blocks when they span lines), and the HTTP method.
  • -u Basic auth, -F multipart uploads, -L redirects and --max-time timeouts.
  • Headers HttpClient refuses to set, like Host and Content-Length, are left out with a note.

Frequently asked questions

Which cURL options are understood?

The ones that shape a request: -X, -H, -d and its variants (--data-raw, --data-binary, --data-urlencode, --json), -F, -u, -b, -A, -e, -G, -I, -L, -k and --max-time. Output options like -s or -o are ignored, and anything else is listed under the result.

Can I paste "Copy as cURL" from the browser?

Yes, in bash or Windows format: $'…' quoting and \, ^ or ` line continuations are handled. Remove session cookies and tokens you don't want in your code.

Is my command uploaded or run?

No. It's parsed and converted in your browser; nothing is sent.