Skip to content

json: Make fromjson less confusing when used with a decode_value#1269

Merged
wader merged 1 commit intomasterfrom
fromjson-decode_value-string
Feb 23, 2026
Merged

json: Make fromjson less confusing when used with a decode_value#1269
wader merged 1 commit intomasterfrom
fromjson-decode_value-string

Conversation

@wader
Copy link
Owner

@wader wader commented Feb 22, 2026

Decoders, like fromjson (uses decode("json")), in fq tries to get a binary from its input which in the case of a decode_value is by default its back binary. So when doing '.. | fromjson | fromjson' the second fromjson will get the same input as the first one. Fix this by doing "tovalue" before decoding as json.

Note that this change only affects fromjson/0 and not the fq specific json/* and from_json/* which will still behave the same as other decoders. So this is more of jq compatilbility fix.

Fixes #1268

Decoders, like fromjson (uses decode("json")), in fq tries to get a binary from
its input which in the case of a decode_value is by default its back binary. So
when doing '.. | fromjson | fromjson' the second fromjson will get the same input
as the first one. Fix this by doing "tovalue" before decoding as json.

Note that this change only affects fromjson/0 and not the fq specific json/* and
from_json/* which will still behave the same as other decoders. So this is more of
jq compatilbility fix.

Fixes #1268
@wader wader merged commit 5b1d9ab into master Feb 23, 2026
5 checks passed
@wader wader deleted the fromjson-decode_value-string branch February 23, 2026 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fq hangs indefinitely when torepr piped to custom function (Ala def:)

1 participant