I'm tweeting this in the hope that it will help me to not forget about it again (I just gave a live demo presentation where I typed this the long way). Since curl 7.82.0 (released March 2022) you can use:
curl --json '{"foo":"bar"}'
instead of:
curl -H "Content-Type: application/json" -d '{"foo":"bar"}'
It also adds the appropriate Accept header.