Open
Description
If running a jq filter produces an empty result, the result is an empty string (''
) even if the output
option is set to json
.
It may be a bit confusing because an empty string is also a different valid result (see examples below).
// this filter yields no results
jq.run('select(.foo == "bar")', {foo: ""}, {input: "json", output: "json"}).then(result => {
// result is an empty string ''
});
// this filter yields an empty string
jq.run('.foo', {foo: ""}, {input: "json", output: "json"}).then(result => {
// result is an empty string ''
});
I believe that undefined
would be a better option because it is used neither in JSON nor in JQ.
Metadata
Metadata
Assignees
Labels
No labels