Replies: 1 comment
-
|
Hi, I tested this from my end using- $.data.mydata[41:44] It appears that Insomnia's current implementation shifts both the starting index and last index down by 1 when processing a range. So for your input: $.data.mydata[41:44] Is this the issue you're facing on your end? Thank you. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
I'm trying to capture a specific slice of an array from an API response using JSONPath in Insomnia, but I haven't been successful so far.
Here’s what I’m trying to achieve: I want to extract a subset of elements from an array in the response. For example, I want to capture elements 40 to 45 from an array named mydata.
Here are some of the JSONPath expressions I’ve tried:
$..mydata[40,45]
$..mydata[40:45]
$..mydata[40:45:1]
Unfortunately, none of these worked. I did notice that using something like $..mydata[40,41,42] returns a list of the specified elements, but I haven’t been able to make a range or slice work.
From my understanding, this should be a valid use case for JSONPath based on references like:
https://goessner.net/articles/JsonPath/index.html#e2
https://github.com/json-path/JsonPath
https://docs.oracle.com/cd/E60058_01/PDF/8.0.8.x/8.0.8.0.0/PMF_HTML/JsonPath_Expressions.htm
Is there a specific syntax or limitation in Insomnia’s JSONPath implementation that I should be aware of? Or is there another way to achieve this?
Any help or guidance would be greatly appreciated!
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions