j9 icon indicating copy to clipboard operation
j9 copied to clipboard

`fromjson` not returning error on parse failure

Open tredmon opened this issue 1 year ago • 0 comments

When j9::run encounters an error in the input it should result in an error, but it currently fails silently.

Example:

let s = j9::run(".a=(.a|fromjson)", "{\"a\":\"4v2\"}").expect("Should have failed at parsing");
panic!("incorrectly returned success : {s:?}");

prints

incorrectly returned success : []

but

jq -n '{a:"4v2"}' | jq '.a=(.a|fromjson)'

prints

jq: error (at :3): Invalid numeric literal at EOF at line 1, column 3 (while parsing '4v2')

tredmon avatar May 18 '24 01:05 tredmon