We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Newline character seem to always get escaped to \\n
\\n
spike@aelesinpc ~> jo -p chat_id=$TGCHAT_ID text="$CI_COMMIT_AUTHOR \n $CI_COMMIT_BRANCH" { "text": " \\n " } spike@aelesinpc ~> jo -p chat_id=$TGCHAT_ID text="$CI_COMMIT_AUTHOR \\n $CI_COMMIT_BRANCH" { "text": " \\n " }
The text was updated successfully, but these errors were encountered:
Bare newlines are not permitted in JSON strings. See the string grammar in https://www.json.org/json-en.html.
string
That said, you actually encoded a literal backslash followed by a literal n. Here's how to encode a newline in a JSON string with jo:
n
jo
$ CI_COMMIT_AUTHOR=aho CI_COMMIT_BRANCH=main # actual newline $ jo -p text="$CI_COMMIT_AUTHOR $CI_COMMIT_BRANCH" { "text": "aho \n main" } # bash-generated newline $ jo -p text="$CI_COMMIT_AUTHOR "$'\n'" $CI_COMMIT_BRANCH" { "text": "aho \n main" }
Sorry, something went wrong.
@gromgit thanks a lot.
No branches or pull requests
Newline character seem to always get escaped to
\\n
The text was updated successfully, but these errors were encountered: