Some tools decide what to do from the file extension, and a temp file called tmp.k3Jd9x doesn’t give them any hint.
GNU mktemp can add the extension for you:
f=$(mktemp --suffix=.json)
curl -s https://example.com/data > "$f"
jq . "$f"
rm "$f"
This creates an empty file such as /tmp/tmp.4fQz8Rk1aB.json and prints its name. The random part keeps the name unique and hard to guess, so you avoid the clashes and symlink tricks that come with a fixed name like /tmp/data.json.
For a directory, use mktemp -d. To control the random part, give a template with at least three X characters: mktemp /tmp/report.XXXXXX.csv also works and ends in .csv.
A caveat: --suffix is a GNU option. The mktemp on macOS is the BSD version and doesn’t know it, but the template form mktemp /tmp/name.XXXXXX works on both, only without the extension after the random part. Remove the file when you are done, or use a trap in a script.
Further reading: mktemp(1) man page