Replies: 1 comment
-
It does not "lose" the newlines. It splits the variable on them. Run
There are two ways to get the elements as one: set -l foo "$(echo '{"response":"\nhello\nand\nhi\n\n"}' | jq .response -r)"
# or
set -l foo (echo '{"response":"\nhello\nand\nhi\n\n"}' | jq .response -r | string collect) The main difference in the latter is that you can pass more options to control what you want, like This is talked about both in https://fishshell.com/docs/current/language.html#command-substitution and https://fishshell.com/docs/current/fish_for_bash_users.html#command-substitutions. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Beta Was this translation helpful? Give feedback.
All reactions