jq-web icon indicating copy to clipboard operation
jq-web copied to clipboard

`jq.json(42, '[]')` returns 42

Open nahoj opened this issue 8 months ago • 1 comments

I started using jq-web in a Node/TypeScript project, and in most cases it works well. Then in some cases, jq.json returns the input object even with a filter that shouldn't do that at all, such as a constant filter.

In the IntelliJ debugger, I set a breakpoint and then "Evaluate expression":

jq.json(42, '[]')
result = 42

Whereas if I just run node in a terminal and try it, I get the correct output ([]).

I realize that this is not a very helpful report but I have limited node/ts skills and no real motivation to dig any further (being on node, I can just switch to node-jq).

I will run specific tests if asked, though.

nahoj avatar Jun 15 '25 19:06 nahoj

Also in the debugger, if I try to evaluate jq.raw('42', '[]'), I get: TypeError: jq.raw is not a function, even in cases when jq.json gave a good result.

nahoj avatar Jun 15 '25 19:06 nahoj