Example

cURL JSON POST Examples

Convert cURL POST requests with JSON bodies into structured JSON and code for Python, JavaScript, Node.js, PHP, Go, Java, C#, Ruby, Swift, and Rust.

Try JSON POST Conversion

Required headers

Most JSON APIs need Content-Type: application/json. The converter also supports curl --json, which sets JSON-oriented headers and request body behavior.

Body parsing

When the payload is valid JSON, output keeps it as an object instead of a raw string so generated code can use native JSON helpers where possible.

Common fixes

If conversion keeps the body as text, check for broken quoting, trailing commas, shell variables, or copied smart quotes in the original command.

JSON POST cURL

curl --json '{"name":"Ada","active":true}' https://api.example.com/users

FAQ

Does --json work?

Yes. The converter treats --json as a JSON request body and adds JSON-oriented headers when they are missing.

Why did my JSON body stay as a string?

The body may not be valid JSON after shell parsing, so the converter keeps the original text instead of guessing.