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.

[Question] JSONPath Sort Array

See original GitHub issue
  • Insomnia Version: 7.0.0
  • Operating System: Win10

Details

Hi folks,

I try to use the Insomnia JSONPath implementation to play with the JSON output I get from the REST call. Can someone tell me how to do the following things on the JSON example below?

  • Sort the array
  • Select second element
  • Select elements starting with …
[
  "myResponse1",
  "myResponse4",
  "myResponse3",
  "myResponse3"
]

The only filter that worked for me was $.* but this is nonsense … -.-

Thanks! Regards -Sergei

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
gschiercommented, Dec 11, 2019

You can type JS into the filter so $..[?(@.match(/^foo/))] should work (untested)

0reactions
stale[bot]commented, May 27, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jsonpath Sort array - Stack Overflow
How do you want to sort it (Id, name or by object)? Could you give more explanation? · When it $..balanceChange execute, I...
Read more >
How to sort json array in javascript? - CodeProject
So start there: JSON.parse()[^] and once you have your data as an array of Javascript objects, sorting (and all other processing) becomes ...
Read more >
Question: Process latest array in json file - Boomi Community
I have a json file that list employeeID and their last hired date. The file contains the same employeeID but with different hired...
Read more >
How to sort a stream of json objects by field value using jq
from man jq. sort, sort_by(path_expression) The sort functions sorts its input, which must be an array. In general and invoking a separate ...
Read more >
Sort an Array of Objects with Power Automate - Tachytelic.net
The question was originally raised on the Power Automate community forums. ... Here is the sample JSON array which we are going to...
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