Dude, I feel you. I wasted hours on this until I found `jq` to format my JSON before posting it with curl.
Try this:
```bash
echo '{"key":"value"}' | jq -c . | curl -H "Content-Type: application/json" -d @- http://example.com/api
```
`jq` ensures your JSON is valid, and `-d @-` reads from stdin. Lifesaver for messy JSON.
Try this:
```bash
echo '{"key":"value"}' | jq -c . | curl -H "Content-Type: application/json" -d @- http://example.com/api
```
`jq` ensures your JSON is valid, and `-d @-` reads from stdin. Lifesaver for messy JSON.
