I did find a solution while I was writing the question: don't put the input inside string interpolation, output a stream of things:

echo '{"foo":"bar", "baz":[1,2,3]}' | jq -r '"My value is:", . , "Some other stuff"'
# .........................................................^^^^^

outputs

My value is:
{
  "foo": "bar",
  "baz": [
    1,
    2,
    3
  ]
}
Some other stuff
Answer from glenn jackman on Stack Overflow
🌐
LornaJane
lornajane.net › posts › 2024 › pretty-print-json-with-jq
Pretty-print JSON with jq | LornaJane
cat is a command to print the contents of the file to stdout. It’s a good way to get content into the start of a chain of commands. The | operator sends the output of the cat command into the next thing in the command. jq is a JSON tool, and the "." part is technically a filter – but it ...
Discussions

jq does not pretty print when output is not a terminal
if I do : cat file.json | jq . I get a formatted (pretty printed) version of the json contained in the file. But if I do: VAR=`cat file.json | jq .` echo $VAR then the output stored in $VAR is not ... More on github.com
🌐 github.com
2
October 1, 2020
json - How to pretty print using jq, so that multiple values are on the same line? - Stack Overflow
I know both forms are valid, and that jq has a compact/pretty print mode. But is there something in-between? I'm looking to somehow format a larger json file that has many more array values than this, so that it's easily readable and printable. More on stackoverflow.com
🌐 stackoverflow.com
Support pretty-printing and colorizing JSON responses for the `api` command when using `jq` expressions
Describe the feature or problem you’d like to solve When using the api command with a jq expression, the CLI currently does not pretty-print nor colorize the post-processed response, even though jq already supports both features. The res... More on github.com
🌐 github.com
4
July 13, 2021
Pretty print your sway tree (bash script, jq is the only dependency)
🌐 r/swaywm
12
42
December 7, 2023
🌐
GitHub
github.com › jqlang › jq › issues › 2185
jq does not pretty print when output is not a terminal · Issue #2185 · jqlang/jq
October 1, 2020 - if I do : cat file.json | jq . I get a formatted (pretty printed) version of the json contained in the file. But if I do: VAR=`cat file.json | jq .` echo $VAR then the output stored in $VAR is not ...
Author   giannis-tsakiris-elsevier
🌐
jq
jqlang.org › manual
jq 1.8 Manual
By default, jq pretty-prints JSON output.
🌐
Kyle Howells Blog
ikyle.me › blog › 2024 › pretty-print-json-terminal
Pretty Print JSON in the Terminal - Kyle Howells
August 8, 2024 - This will print the JSON response in a readable, pretty-printed format. jq is actually meant not to pretty print json, but to transform and manipulate json data. The . argument to it tells it to return the input unchanged as the output.
Find elsewhere
🌐
Discoposse
discoposse.com › home › using jq to pretty print json output
Using jq to pretty print JSON output - DiscoPosse.com
November 12, 2017 - There is much, much more to what you can do with the jq tool, but this was something that I thought was a good start. Make sure to download it at the jq site, and it is already included in some platforms like CoreOS out of the box. Nice article and would love suggest a tool which does the job. https://jsonformatter.org/json-pretty-print Reply
🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-transform-json-data-with-jq
How To Transform JSON Data with jq | DigitalOcean
September 23, 2025 - By default, jq will pretty print its output. It will automatically apply indentation, add new lines after every value, and color its output when possible. Coloring may improve readability, which can help many developers as they examine JSON data produced by other tools.
🌐
Nick Janetakis
nickjanetakis.com › blog › pretty-print-json-in-your-terminal-with-jq-or-python
Pretty Print JSON in Your Terminal with jq or Python — Nick Janetakis
July 4, 2023 - I created a small ppjson script which is available in my dotfiles. It requires having jq installed and it will either use xclip or pbpaste depending on what OS you have. ... # Pretty print the contents of your clipboard with 2 spaces of indentation ppjson # Pretty print the content of a file ppjson data.json
🌐
Shapeshed
shapeshed.com › jq-json
JSON on the command line with jq | George Ornbo
September 19, 2024 - jq can pretty print this file using the . filter. This takes the entire input and sends it to standard output.
🌐
Linux Handbook
linuxhandbook.com › pretty-print-json
Pretty Print JSON in Linux Command Line
January 6, 2023 - If you're on a Debian-based distro, you can use this command: ... The json_pp is a Perl module intended to convert the input to different output formats and can also be used to pretty print JSON files.
🌐
Heitor's Log
heitorpb.github.io › bla › prettify-uglify-jsons-in-vim
Prettify and uglify JSONs in Vim | Heitor's log
March 27, 2024 - jq/jq -c: the commands (filters) to modify the selected text. jq prints a pretty JSON, while jq -c uglifies the JSON into a compact output.
🌐
OSTechNix
ostechnix.com › home › command line utilities › how to parse and pretty print json with linux commandline tools
Parse And Pretty Print JSON Using Jq In Linux - OSTechNix
March 21, 2023 - Raw data print - For any reason, if you need only the final parsed data, not enclosed within a double quote, use the -r flag with the jq command, like this. - jq -r .foo.bar. To filter out a specific part of JSON, you've to look into the pretty printed JSON file's data hierarchy.
🌐
Leapcell
leapcell.io › blog › how-to-pretty-print-json
How to Pretty Print JSON | Leapcell
July 25, 2025 - JavaScript's JSON.stringify() method can be used to pretty print JSON: const data = { name: "Alice", age: 25, city: "New York" }; console.log(JSON.stringify(data, null, 2)); Here, the third argument specifies the number of spaces for indentation.
🌐
Reddit
reddit.com › r/swaywm › pretty print your sway tree (bash script, jq is the only dependency)
r/swaywm on Reddit: Pretty print your sway tree (bash script, jq is the only dependency)
December 7, 2023 - Help with JQL statement for queue filter · r/jira • · r/jira · Members Online · upvote · · comments · Tree WIP · r/WireWrapping • · r/WireWrapping · A subreddit for people who love and create wire wrapped goodies, jewelry and whatnot. A friendly place to post your questions, comments, pictures, and tutorials.
🌐
thanoskoutr
thanoskoutr.com › posts › pretty-print-json
Pretty Print JSON in Linux Terminal :: thanoskoutr
February 16, 2023 - Here’s the command to pretty-print a JSON file using Python: ... The command reads the JSON file, formats it, and prints it to the standard output. Similary, we can pipe the results of commands or file output to jq and it will pretty-print the JSON data in the standard output:
🌐
JSON Formatter
jsonformatter.org › json-pretty-print
Best JSON Pretty Print Online
JSON Pretty Print is very unique tool for prettify json and pretty print JSON data in color.
🌐
GitHub
github.com › jqlang › jq › issues › 1310
request: make jq stdin accept json and output pretty print json · Issue #1310 · jqlang/jq
January 17, 2017 - it's very common to use jq to pretty print json. would it hurt to have jq accept stdin standard and output as if it had been called as jq .[]
Author   conrado