user1424739
user1424739

Reputation: 13735

How to escape string in `jq`?

I'd like to just print a. I don't find how to do so. Could anybody let me know how to do it? Thanks.

$ jq '.' <<< '"a"'
"a"

Upvotes: 0

Views: 4061

Answers (1)

Seth
Seth

Reputation: 338

Use the --raw-output/-r flag.

From the documentation:

With this option, if the filter’s result is a string then it will be written directly to standard output rather than being formatted as a JSON string with quotes. This can be useful for making jq filters talk to non-JSON-based systems.

Upvotes: 4

Related Questions