owenthereal / jqplay

A playground for jq, written in Go
https://jqplay.org
MIT License
740 stars 88 forks source link

Running specific jq query via jqplay.org fails while the same via cli works #150

Closed hmarko closed 10 months ago

hmarko commented 11 months ago

Hi.

I'm trying to run the following jq via jqplay and it fails while running the same using jq cli works:

This should be working with any json input.

query: .|[leaf_paths as $path|{key: $path|join("^"), value: getpath($path)}]

jqplay result: jq: error: leaf_paths/0 is not defined at , line 1: .|[leaf_paths as $path|{key: $path|join("^"), value: getpath($path)}]
jq: 1 compile error exit status 3

CLI:

cat /tmp/a.json | jq '.|[leaf_paths as $path|{key: $path|join("^"), value: getpath($path)}]' [ { "key": "glossary^title", "value": "example glossary" } ]

wader commented 11 months ago

Hey, i think this is because leaf_paths/0 was removed in 1.7. See https://github.com/jqlang/jq/pull/2666

owenthereal commented 10 months ago

@hmarko Let us know if you have more questions. Feel free to hop on our discord server if you need more help.