question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] JsonPath query regression with filtering array

See original GitHub issue
  • Insomnia Version: 6.6.0
  • Operating System: Kubuntu 18.10

Details

In the latest version, my query through a list of objects comparing/equating to a certain property doesn’t work anymore.

In my example data, my query is $.clients[?(@.id == 2049)] In my dataset, clients is an array of objects with several properties, with id being a number. In the previous version of insomnia (i don’t remember the exact version, the previous release of 6.6.0)

Any comparison similar to the query above only returns zero results. eg. id > 2050, id < 2051 is the same with empty results.

{
  "clients": [
    {
      "appointments": [],
      "email": "client1@gmail.com",
      "firstname": "client1",
      "fullname": "client1 test",
      "id": 2049,
      "lastname": "test"
    },
    {
      "appointments": [],
      "email": "client2@gmail.com",
      "firstname": "client2",
      "fullname": "client2 test",
      "id": 2050,
      "lastname": "test"
    },
    {
      "appointments": [],
      "email": "client3@gmail.com",
      "firstname": "client3",
      "fullname": "client3 test",
      "id": 2051,
      "lastname": "test"
    }
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
gschiercommented, Aug 7, 2019

It looks like the JSONPath dependency version may have changed by accident in the last release. Taking a look now.

As for your original problem, @jrods. Your response is invalid JSON. The array of clients is missing a closing bracket. Even after fixing that it still doesn’t work though 😦

0reactions
qn-ngcommented, Aug 8, 2019

@Ravelman v6.6.2 released yesterday had fixed this error

Read more comments on GitHub >

github_iconTop Results From Across the Web

json - How to filter by string in JSONPath? - Stack Overflow
Your query looks fine, and your data and query work for me using this JsonPath parser. Also see the example queries on that...
Read more >
Part 4 - JSONPath Expression for JSON Array aka List via Filters
In this video I've covered the following: -What are Filters ?Why do we need Filters ?SyntaxCommonly Used Filter OperatorsExamples.
Read more >
JSON Path Expressions | Exasol DB Documentation
The function toarray() returns all SQL/JSON values identified by the path as an array. This is useful to identify paths that return more...
Read more >
Experimental array.filter() function | Flux 0.x Documentation
array.filter() iterates over an array, evaluates each element with a predicate function, and then returns a new array with only elements that match...
Read more >
jsonb_array_elements() fails with "ERROR: cannot extract ...
As the name suggests, jsonb_array_elements() expects a JSON array to unnest. But, according to your error message, at least one row contains a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found