> ## Content Index
> Fetch the complete content index at: https://logbuch-dev-blog.nichedthemes.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# curl --json sets both headers for you
- URL: https://logbuch-dev-blog.nichedthemes.com/curl-json-sets-both-headers/
- Published: 2026-11-12T16:05:00.000Z
- Updated: 2026-11-12T16:05:00.000Z
- Author: Mira Okafor
- Tags: Tooling, #til, #Import 2026-11-19 07:37

Since curl 7.82, `--json` sends the body as data and sets `Content-Type` and `Accept` to `application/json` in one go.

```console
$ curl --json '{"url":"https://example.org/a/long/path"}' localhost:8080/api/links
{"code":"k3x9","url":"https://example.org/a/long/path"}
```

Before, I typed `-H` twice and forgot one of them every other time.