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.

[FEATURE REQUEST] JSONPath/XPath access to Environment Variables

See original GitHub issue

[Feature Request]

Would like to ability to use specific workspace environment variables in the JSONPath queries.

Currently we querying API with specific order numbers and am getting back very large JSON response for customer. Would like to filter the JSONPath filter using the variable that is set on the GET API request.

This would also be valuable for those that are constantly running the same JSONPath queries for that specific environment - for example if you are always running $..[?(@.customer == '50')] to filter out the information for just that environment (per call) so that you can have set environment variables you can use for JSON responses that are returned on an environment basis.

The data may change, which is why it would be nice to parse out specific environment variables that you can throw into the JSONPath query section. The history is very useful, but if the query is long enough, it is a lot easier to use specific variables (such as CustomerID, FQDNs, etc) to add into the JSONPath query.

–>

  • Insomnia Version: Version 6.6.2 (6.6.2.2932)
  • Operating System: macOSMojave version 10.14.16

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
gschiercommented, Aug 20, 2019

I like the idea of supporting environment variables in as many places as possible. Using them in JSONPath for the response makes sense I think.

There are three places JSONPath filters can be used, however, and one of them would be much more difficult to enable variable support.

  1. The filter input box beneath the response
  2. The Response template tag used for chaining requests (difficult)
  3. In the JSONPath template tag (difficult)

The implementation for No. 1 would be fairly trivial and would probably cover most use cases. Is this where you are looking to use it? If so, I could hook this up in just a few minutes as we just need to render the filter string before passing it into the filter library.

0reactions
js-modecommented, Dec 13, 2019

@gschier – would really liked to get an update on this feature. would be really helpful when I need to pass in Environment Variables for the response filters.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JSONPath/XPath access to Environment Variables #3731
Currently we querying API with specific order numbers and am getting back very large JSON response for customer. Would like to filter the...
Read more >
JSONPath and XPath User Guide
This section provides high level guidance on JSONPath and XPath along with various examples of JSONPath and XPath expressions. JSONPath is a query...
Read more >
JSONPath - XPath for JSON - stefan.goessner
JSON data requested by the client can be reduced to the relevant parts on the server, such minimizing the bandwidth usage of the...
Read more >
JSONPath -- XPath for JSON - IETF
Specifying the relevant parts of the JSON data in a request by a client, so the server can reduce the data in the...
Read more >
JSON Path Expressions - SQL Server - Microsoft Learn
In this article​​ Use JSON path expressions to reference the properties of JSON objects. You have to provide a path expression when you...
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