-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Description
Thank you for this life-changing language. I regret that my first correspondence is a complaint.
Try-catch returns empty following filter assignment.
Input
jq -nc '{foo: "bar"} | .foo |= .?'
Expected output
{"foo":"bar"}
Actual output
{}
Furthermore, //
is unable to catch the result:
$ jq -nc '{foo: "bar"} | .foo |= ( .? // "baz" )'
{}
Environment (please complete the following information):
- Debian Stretch, jq 1.5
- jqplay, jq 1.6
This is an extremely minimized example; I'm actually trying to process incoming strings which may or may not contain valid JSON, as in .value |= (fromjson? // .)
. I catch some undocumented error formatting when I try this:
$ jq -nc '{value: "[]"} | .value |= try fromjson catch .'
{"value":{"__jq":0}}
Thanks again for your efforts.