Skip to content

Cannot use JSONPath to get keys #1464

Open
@janwytze

Description

@janwytze

What is the current bug behavior?

I cannot use JSONPath to receive object keys.

Steps to reproduce

This is the object I try to get keys from:

{
  "id": 1,
  "attachments": {
    "key1": {
      "created_at": "2023-04-18T11:22:36Z"
    },
    "key2": {
      "created_at": "2023-04-18T11:22:36Z"
    },
    "key3": {
      "created_at": "2023-04-18T11:22:36Z"
    }
  }
}

The following JSONPath queries do not work:

  • $.attachments.keys()
  • $.attachments.*~
  • $.attachments.*.@

What is the expected correct behavior?

I would expect one of the above to work. The result should be the following:

[
"key1",
"key2",
"key3"
]

Execution context

  • Hurl Version (hurl --version):
hurl 2.0.1 libcurl/7.81.0 OpenSSL/3.0.2 zlib/1.2.11 brotli/1.0.9 zstd/1.4.8 libidn2/2.3.2 libssh/0.9.6/openssl/zlib nghttp2/1.43.0
Features (libcurl):  alt-svc AsynchDNS brotli HSTS HTTP2 IDN IPv6 Largefile libz NTLM NTLM_WB SPNEGO SSL TLS-SRP UnixSockets zstd
Features (built-in): brotli
  • Operating system and version: Ubuntu 22.04

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions