Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
hmarko opened this issue Nov 19, 2023 · 2 comments
Closed

Comments

@hmarko
Copy link

hmarko commented Nov 19, 2023

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
Copy link
Contributor

wader commented Nov 19, 2023

Hey, i think this is because leaf_paths/0 was removed in 1.7. See jqlang/jq#2666

@owenthereal
Copy link
Owner

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

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

No branches or pull requests

3 participants