3 ms·
This behaviour looks confusing to me: $ echo '{"name":{"first":"Tom","middle":"null","last":"Smith"}}' | jj name.middle null $ echo '{"name":{"first":"Tom","
by Rygian 3y ago
This behaviour looks confusing to me:
$ echo '{"name":{"first":"Tom","middle":"null","last":"Smith"}}' | jj name.middle
null
$ echo '{"name":{"first":"Tom","last":"Smith"}}' | jj name.middle
null
It can be avoided with option '-r' which should be the default, but is not.
- planede 3y agoI don't get this behavior for your second command, it just seems to return an empty string. edit: There are three cases to cover: 1. The value at the path exists and not null. 2. The value at the path exists and is null. 3. The value at the path doesn't exist. jj seems to potentially confuse 1 and 2 without the -r flag. "middle": "null" and "middle": null more specifically. It probably confuses "middle": "" and missing value as well, that's 1 and 3.