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

Failure to parse .x.["y.z"] notation #1168

Closed
mcint opened this issue Jun 21, 2016 · 14 comments
Closed

Failure to parse .x.["y.z"] notation #1168

mcint opened this issue Jun 21, 2016 · 14 comments

Comments

@mcint
Copy link

mcint commented Jun 21, 2016

mcint@work MINGW64 /c/git

The document

$ less test.json | jq -c '.'
{"a":"A","b":{"c":{"d.e.f":"DEF"}}}

The complex key

$ less test.json | jq -c '.b.c'
{"d.e.f":"DEF"}

One naive approach

$ less test.json | jq -c '.b.c.d.e.f'
null

Solution proposed by the docs

$ less test.json | jq -c '.b.c.["d.e.f"]'
jq: error: syntax error, unexpected '[', expecting FORMAT or QQSTRING_START (Windows cmd shell quoting issues?) at <top-level>, line 1:
.b.c.["d.e.f"]
jq: 1 compile error

Work-around

$ less test.json | jq -c '.b.c | .["d.e.f"]'
"DEF"

Boundaries of quoted key solution

$ less test.json | jq -c '.b | .c.["d.e.f"]'
jq: error: syntax error, unexpected '[', expecting FORMAT or QQSTRING_START (Windows cmd shell quoting issues?) at <top-level>, line 1:
.b | .c.["d.e.f"]
jq: 1 compile error
@mcint
Copy link
Author

mcint commented Jun 21, 2016

Trials with 2-part ("z.y") versus 3-part ("z.y.x") key

$ less test2.json | jq -c '.b.c'
{"d.e": "DEF"}
$ less test2.json | jq -'c .b.c.d.e'
null
$ less test2.json | jq -c '.b.c.["d.e"]'
jq: error: syntax error, unexpected '[', expecting FORMAT or QQSTRING_START (Windows cmd shell quoting issues?) at <top-level>, line 1:
.b.c.["d.e"]
jq: 1 compile error

@ghost
Copy link

ghost commented Jun 21, 2016

The syntax is either .foo (for keys without extraneous characters) or ["foo.bar"] (note the absence of a trailing dot). That is:

jq '.b | .c["d.e.f"]'
jq '.b.c["d.e"]'

So, you may be wondering: how come jq '.b.c | .["d.e.f"]' does work? The answer lies in that the output of the previous filter is represented by .. Therefore, .["d.e.f"] performs ["d.e.f"] over .. The dot can be elided when using .foo as the first filter: that's why it's .b.c and not ..b.c.

@mcint
Copy link
Author

mcint commented Jun 21, 2016

Great, that completely addresses my question, thank you. Good to close.

For the sake of completeness, it looks like the dot must be elided.

$ less test2.json | jq '..b.c'
jq: error: syntax error, unexpected IDENT, expecting $end (Windows cmd shell quoting issues?) at <top-level>, line 1:
..b.c
jq: 1 compile error

@ghost
Copy link

ghost commented Jun 21, 2016

Yes, that is correct: the dot must be elided. I misspoke in my earlier comment.

@rogpeppe
Copy link

This seems to be a documentation issue. The reference documentation
describes the operator as .[0] and says:

When the index value is an integer, .[<value>] can index arrays

This appears to be true only if the dot is at the start. There
are no examples of an array index not at the start, and no
indications that I've found that the dot is not allowed in that
case.

@wtlangford
Copy link
Contributor

wtlangford commented May 11, 2017 via email

@nicowilliams
Copy link
Contributor

My question is: should we add .a.["b"]? I'm tempted to say "no", but this does come up frequently enough that maybe it'd just be for the best. What do we lose if we add this?

@MondayHopscotch
Copy link

This is something I recently ran into, as well. Simplified examples using JQPlay:

With dot (syntax error):
https://jqplay.org/s/itgHiQlNMP

Without dot (happy):
https://jqplay.org/s/AWemvC2Vsv

Is this something that there is a concrete reason behind disallowing? Or is it just a limitation of the current implementation?

Wording my question another way: Is there any reason that supporting this in the future would be explicitly unwanted?

@nicowilliams
Copy link
Contributor

@MondayHopscotch There is no limitation of the current implementation that makes this difficult to support.

As to reasons not to support this, I don't think there are any, and this is a very very FAQ.

This trivial patch adds support for this:

diff --git a/src/parser.y b/src/parser.y
index 6255850..39c7836 100644
--- a/src/parser.y
+++ b/src/parser.y
@@ -685,6 +685,12 @@ Term '[' Exp ']' '?' {
 Term '[' Exp ']' %prec NONOPT {
   $$ = gen_index($1, $3);
 } |
+Term '.' '[' Exp ']' '?' {
+  $$ = gen_index_opt($1, $4);
+} |
+Term '.' '[' Exp ']' %prec NONOPT {
+  $$ = gen_index($1, $4);
+} |
 Term '[' ']' '?' {
   $$ = block_join($1, gen_op_simple(EACH_OPT));
 } |
$ ./jq -cn '{a:{b:{c:"d"}}}|.a.["b"]'
{"c":"d"}
$ 

@nicowilliams
Copy link
Contributor

@wtlangford any objections to pushing that patch?

@rogpeppe
Copy link

rogpeppe commented Mar 8, 2019

The syntax is either .foo (for keys without extraneous characters) or ["foo.bar"] (note the absence of a trailing dot).

Perhaps the real issue here is that the documentation doesn't explain the grammar clearly. I can't see anything in the documentation that mentions that [] can be used as an operator at all.

Note that .a.b.c is the same as .a | .b | .c

AFAICS . is being used in two senses here - as an initial value (the first .) and then as a special case as a binary operator. Currently the filter documentation elides the operands for each operator. Perhaps if it didn't, then things might be more obvious.

One other thing: .x.y? works, and the docs document the .foo? form exactly the same was as .[<string>] so it's perhaps not surprising people get confused when .x.["<string>"] doesn't work.

@nicowilliams
Copy link
Contributor

There is certainly a bug in the manual...

   For  example  .["foo::bar"]  and .["foo.bar"] work while .foo::bar does
   not, and .foo.bar means .["foo"].["bar"].

@nicowilliams
Copy link
Contributor

@rogpeppe https://github.com/stedolan/jq/wiki/jq-Language-Description

@nicowilliams nicowilliams self-assigned this Mar 25, 2019
@nicowilliams
Copy link
Contributor

I've pushed 3e0a118 to allow '.foo.["bar"] syntax.

fuzzypixelz added a commit to fuzzypixelz/zenoh-python that referenced this issue Apr 17, 2024
ubuntu-22.04 runners use jq 1.6 which doesn't recognize a dot for `[]` value iterator.

See: jqlang/jq#1168.
fuzzypixelz added a commit to fuzzypixelz/zenoh-kotlin that referenced this issue Apr 17, 2024
ubuntu-22.04 runners use jq 1.6 which doesn't recognize a dot for `[]` value iterator.

See: jqlang/jq#1168.
fuzzypixelz added a commit to fuzzypixelz/zenoh-c that referenced this issue Apr 17, 2024
ubuntu-22.04 runners use jq 1.6 which doesn't recognize a dot for `[]` value iterator.

See: jqlang/jq#1168.
Mallets pushed a commit to eclipse-zenoh/zenoh-python that referenced this issue Apr 17, 2024
* build: Get Read the Docs release number from Cargo manifest

This avoids hardcoding the release number in the documentation build config,
making it easier to bump the version by only modifying the manifest.

* build: Require Python 3.11 in Read the Docs configuration

Python 3.11 is needed to access tomllib; useful for parsing the Cargo manifest file.

* feat: Create branch, bump version and tag in release workflow

* feat: Add publish-github job

* fix: Broken tag dependencies

* chore: Remove enforce-linking-issues workflow

* fix: Bump version in pyproject.toml

* chore: Upgrade artifact actions from v3 to v4

* fix: Typo in git-commit command

* fix: Support jq 1.6

ubuntu-22.04 runners use jq 1.6 which doesn't recognize a dot for `[]` value iterator.

See: jqlang/jq#1168.

* Revert "chore: Upgrade artifact actions from v3 to v4"

This reverts commit a535971.

* fix: Build wheels from release branch

* fix: Switch to pypa/gh-action-pypi-publish@release/v1

The older actions doesn't recognize the pyproject.toml metadata fields.
Mallets pushed a commit to eclipse-zenoh/zenoh-kotlin that referenced this issue Apr 17, 2024
* feat: Store project version in version.txt

* fix: Remove cargo-deb metadata section in `zenoh-jni`

* feat: Add `bump-and-tag.bash` script

* chore: Rename release workflow to pre-release

* chore: Disable release event on publish workflows

* fix: Typo in ci/scripts

* feat: Automate Release

* chore: Remove enforce-linking-issues workflow

* fix: Set permissions for publishing jobs

* feat: Add publish-dokka to release workflow

* fix: Set release branch in publishing jobs

* fix: Make `branch` input unrequired in publishing jobs

* style: Uniformize publishing workflow names

* fix: Unecessary use of `BOT_TOKEN_WORKFLOW`

* fix: Incorrect Cargo manifest/lockfile path

* fix: Add missing `live-run` input for publish-dokka job

* fix: Typo in pre-release workflow name

* fix: Remove `if: always()` in publish-github job

* fix: Remove unecessary SSH passphrase/privatekey inputs

* chore: Retrigger CI

* fix: Support jq 1.6

ubuntu-22.04 runners use jq 1.6 which doesn't recognize a dot for `[]` value iterator.

See: jqlang/jq#1168.
wyfo pushed a commit to ZettaScaleLabs/zenoh-python that referenced this issue Apr 25, 2024
* build: Get Read the Docs release number from Cargo manifest

This avoids hardcoding the release number in the documentation build config,
making it easier to bump the version by only modifying the manifest.

* build: Require Python 3.11 in Read the Docs configuration

Python 3.11 is needed to access tomllib; useful for parsing the Cargo manifest file.

* feat: Create branch, bump version and tag in release workflow

* feat: Add publish-github job

* fix: Broken tag dependencies

* chore: Remove enforce-linking-issues workflow

* fix: Bump version in pyproject.toml

* chore: Upgrade artifact actions from v3 to v4

* fix: Typo in git-commit command

* fix: Support jq 1.6

ubuntu-22.04 runners use jq 1.6 which doesn't recognize a dot for `[]` value iterator.

See: jqlang/jq#1168.

* Revert "chore: Upgrade artifact actions from v3 to v4"

This reverts commit a535971.

* fix: Build wheels from release branch

* fix: Switch to pypa/gh-action-pypi-publish@release/v1

The older actions doesn't recognize the pyproject.toml metadata fields.
diogomatsubara pushed a commit to ZettaScaleLabs/zenoh-c that referenced this issue Jul 10, 2024
ubuntu-22.04 runners use jq 1.6 which doesn't recognize a dot for `[]` value iterator.

See: jqlang/jq#1168.
Mallets added a commit to eclipse-zenoh/zenoh-python that referenced this issue Aug 2, 2024
* chore: bump pyo3 to 0.21 (#175)

Roughly adapt the code to the new PyO3 API, with a few warning fixes.

* fix(examples): fix commented parts of z_put.py (#176)

* fix(examples): fix commented parts of z_put.py

* fix: apply PR reviews

* fix: apply PR reviews

* Correct the syntax of pyproject.toml (#181)

* feat: Automate Release (#165)

* build: Get Read the Docs release number from Cargo manifest

This avoids hardcoding the release number in the documentation build config,
making it easier to bump the version by only modifying the manifest.

* build: Require Python 3.11 in Read the Docs configuration

Python 3.11 is needed to access tomllib; useful for parsing the Cargo manifest file.

* feat: Create branch, bump version and tag in release workflow

* feat: Add publish-github job

* fix: Broken tag dependencies

* chore: Remove enforce-linking-issues workflow

* fix: Bump version in pyproject.toml

* chore: Upgrade artifact actions from v3 to v4

* fix: Typo in git-commit command

* fix: Support jq 1.6

ubuntu-22.04 runners use jq 1.6 which doesn't recognize a dot for `[]` value iterator.

See: jqlang/jq#1168.

* Revert "chore: Upgrade artifact actions from v3 to v4"

This reverts commit a535971.

* fix: Build wheels from release branch

* fix: Switch to pypa/gh-action-pypi-publish@release/v1

The older actions doesn't recognize the pyproject.toml metadata fields.

* Force sphinx version to 7.2.6 (#185)

* fix: Install maturin according to requirements-dev.txt (#186)

* fix: fix scout deadlock (#188)

Releasing GIL in Scout destructor prevents the deadlock.

* fix(uhlc): bump uhlc version (#173)

Signed-off-by: gabrik <gabriele.baldoni@gmail.com>
Co-authored-by: Luca Cominardi <luca.cominardi@gmail.com>

* feat(tracing): using zenoh-util function for log initialization (#172)

* feat(tracing): using zenoh-util function for log initialization

Signed-off-by: gabrik <gabriele.baldoni@gmail.com>

* chore: adding Cargo.lock

Signed-off-by: gabrik <gabriele.baldoni@gmail.com>

* feat(tracing): using zenoh main

Signed-off-by: gabrik <gabriele.baldoni@gmail.com>

* chore: using new try_init_log_from_env

Signed-off-by: gabrik <gabriele.baldoni@gmail.com>

* chore: sync Cargo.lock

Signed-off-by: gabrik <gabriele.baldoni@gmail.com>

---------

Signed-off-by: gabrik <gabriele.baldoni@gmail.com>
Co-authored-by: Luca Cominardi <luca.cominardi@gmail.com>

* feat: add Attachment to API (#189)

* feat: add Attachment to API

* fix: make attachment a CLI arg in z_put example

* Update zenoh/session.py

Co-authored-by: Luca Cominardi <luca.cominardi@gmail.com>

* Apply suggestions from code review

Co-authored-by: Luca Cominardi <luca.cominardi@gmail.com>

* test: add test for attachment

---------

Co-authored-by: Luca Cominardi <luca.cominardi@gmail.com>

* build: Sync  with eclipse-zenoh/zenoh@81217c7 from 2024-04-22 (#190)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* fix: Create virtual environment for armv6 build (#191)

* build: Sync  with eclipse-zenoh/zenoh@2fdddae from 2024-04-23 (#192)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* build: Sync  with eclipse-zenoh/zenoh@9a9832a from 2024-04-24 (#193)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* build: Sync  with eclipse-zenoh/zenoh@7c64d99 from 2024-04-26 (#194)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* build: Sync  with eclipse-zenoh/zenoh@ad58af6 from 2024-04-26 (#195)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* build: Sync  with eclipse-zenoh/zenoh@e8916bf from 2024-04-26 (#196)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* build: Sync  with eclipse-zenoh/zenoh@ea604b6 from 2024-04-29 (#197)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* build: Sync  with eclipse-zenoh/zenoh@371ca6b from 2024-04-30 (#198)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* build: Sync  with eclipse-zenoh/zenoh@7a47445 from 2024-05-03 (#200)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* build: Sync  with eclipse-zenoh/zenoh@f5195c0 from 2024-05-03 (#202)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* build: Sync  with eclipse-zenoh/zenoh@e53364f from 2024-05-04 (#203)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* test: add z_ping/z_pong examples (#205)

* fix: make attachment API more similar to dict API (#201)

* fix: make attachment API more similar to dict API

* fix: fix formatting

* fix: fix formatting

* fix: fix typing

* fix: uncomment tests 😅

* docs: add docstring for Attachment

* build: Sync  with eclipse-zenoh/zenoh@7e5d5e8 from 2024-05-07 (#206)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* fix: add `Encoding.with_suffix` instead of `Encoding.append` (#208)

* fix: add `Encoding.with_suffix` instead of `Encoding.append`

* feat: add `prefix`/`suffix` methods to `Encoding`

* build: Sync  with eclipse-zenoh/zenoh@b8dd01d from 2024-05-07 (#209)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* Support timeout for get in session.

Signed-off-by: ChenYing Kuo <evshary@gmail.com>

* Update PR based on the review.

Signed-off-by: ChenYing Kuo <evshary@gmail.com>

* Fix CI lint error.

Signed-off-by: ChenYing Kuo <evshary@gmail.com>

* Update: PyTypeError => PyValueError

Signed-off-by: ChenYing Kuo <evshary@gmail.com>

* build: Sync  with eclipse-zenoh/zenoh@45e05f0 from 2024-05-13 (#212)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* build: Sync  with eclipse-zenoh/zenoh@763a05f from 2024-05-14 (#213)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* build: Sync  with eclipse-zenoh/zenoh@75aa273 from 2024-05-15 (#214)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* build: Sync  with eclipse-zenoh/zenoh@25f06bd from 2024-05-21 (#215)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* build: Sync  with eclipse-zenoh/zenoh@3118d31 from 2024-05-28 (#216)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* build: Sync  with eclipse-zenoh/zenoh@d574654 from 2024-06-03 (#217)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* chore: Update artifacts action to v4 (#218)

artifacts actions v3 are deprecated

* fix: give unique name for artifacts (#220)

upload-artifacts/v4 has a breaking change from v3, which requires the
artifacts names to be unique. Fix #219

* build: Sync  with eclipse-zenoh/zenoh@c279982 from 2024-06-05 (#221)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* build: Sync  with eclipse-zenoh/zenoh@d8e66de from 2024-06-10 (#222)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* build: Sync  with eclipse-zenoh/zenoh@9d09742 from 2024-06-11 (#223)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* Fix markdown format in README. (#211)

Signed-off-by: ChenYing Kuo <evshary@gmail.com>

* build: Sync  with eclipse-zenoh/zenoh@ed6c636 from 2024-06-12 (#225)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* build: Sync  with eclipse-zenoh/zenoh@8160b01 from 2024-06-13 (#228)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* Enable releasing from any branch (#227)

* build: Sync  with eclipse-zenoh/zenoh@7adad94 from 2024-06-14 (#230)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* build: Sync  with eclipse-zenoh/zenoh@93f93d2 from 2024-06-17 (#231)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* build: Sync  with eclipse-zenoh/zenoh@2500e5a from 2024-06-20 (#236)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* fix: remove deprecated maturin arg (#241)

See PyO3/maturin#1620, `--universal2` has been
deprecated

* build: Sync  with eclipse-zenoh/zenoh@869ace6 from 2024-07-02 (#247)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* build: Sync  with eclipse-zenoh/zenoh@b93ca84 from 2024-07-03 (#248)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* build: Sync  with eclipse-zenoh/zenoh@b3e42ce from 2024-07-08 (#252)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* build: Sync  with eclipse-zenoh/zenoh@b3e42ce from 2024-07-08 (#253)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* build: Sync  with eclipse-zenoh/zenoh@b3e42ce from 2024-07-08 (#259)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* build: Sync  with eclipse-zenoh/zenoh@0a969cb from 2024-07-25 (#261)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* build: Sync  with eclipse-zenoh/zenoh@0a969cb from 2024-07-25 (#262)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* build: Sync  with eclipse-zenoh/zenoh@e587aa9 from 2024-07-26 (#265)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* build: Sync  with eclipse-zenoh/zenoh@2d88c7b from 2024-07-29 (#268)

Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>

* chore: remove useless dependencies

---------

Signed-off-by: gabrik <gabriele.baldoni@gmail.com>
Signed-off-by: ChenYing Kuo <evshary@gmail.com>
Co-authored-by: Yuyuan Yuan <az6980522@gmail.com>
Co-authored-by: Mahmoud Mazouz <mazouz.mahmoud@outlook.com>
Co-authored-by: oteffahi <70609372+oteffahi@users.noreply.github.com>
Co-authored-by: Gabriele Baldoni <gabrik@users.noreply.github.com>
Co-authored-by: Luca Cominardi <luca.cominardi@gmail.com>
Co-authored-by: eclipse-zenoh-bot <61247838+eclipse-zenoh-bot@users.noreply.github.com>
Co-authored-by: eclipse-zenoh-bot <eclipse-zenoh-bot@users.noreply.github.com>
Co-authored-by: ChenYing Kuo <evshary@gmail.com>
Co-authored-by: kydos <kydos@protonmail.com>
Co-authored-by: Diogo Matsubara <diogo.matsubara@pm.me>
Co-authored-by: Diogo Matsubara <diogo.matsubara@zettascale.tech>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants