Skip to content

Output as null terminated string \0 #3118

Closed Answered by wader
lamyergeier asked this question in Q&A
Discussion options

You must be logged in to vote

Yes use --raw-output0

$ jq -n --raw-output0 '"abc","def"' | hexdump -C
00000000  61 62 63 00 64 65 66 00                           |abc.def.|
00000008

but there is caveat

$ jq -n --raw-output0 '"\u0000"'
jq: error (at <unknown>): Cannot dump a string containing NUL with --raw-output0 option

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by emanuele6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants