insomnia icon indicating copy to clipboard operation
insomnia copied to clipboard

feat: move to jq

Open kobenguyent opened this issue 1 year ago β€’ 7 comments

Motivation: jq, while being more powerful than JSONPath, nevertheless enables one to write queries that are usually as simple as, and sometimes even simpler than, the corresponding JSONPath queries.

resolves #777 resolves #3258 resolves #2342 resolves #3155

https://github.com/Kong/insomnia/assets/7845001/5e97f72b-a2ec-4d30-9497-6394d691c8c4

kobenguyent avatar Sep 20 '23 15:09 kobenguyent

Considering jq uses a downloaded executable, you might want to consider something more integrated to Javascript like JSONata

bbbco avatar Sep 20 '23 17:09 bbbco

Thanks. I'll check it out. πŸ˜„

kobenguyent avatar Sep 20 '23 17:09 kobenguyent

I think we would still use node-jq instead of using another as jq is quite popular and its simplicity as well as performance.

For this PR, I guess we should have backwards compatibility with users are using JSONPath in their collections. As we drop the JSONPath, it would ruin the chain requests where the JSONPath is used to query.

kobenguyent avatar Sep 21 '23 04:09 kobenguyent

Well, I think I'll try with this approach then. Copying the node-jq lib along with the binaries and minimizing the lib source code inside insomnia. That would somehow be a better way. Love to hear the feedbacks.

kobenguyent avatar Sep 22 '23 06:09 kobenguyent

@kobenguyent thanks for the pr πŸ‘. Adding extra binaries makes the build process highly dependent on them (currently we use node-libcurl) and makes testing and deploying to different platforms more difficult. So we avoid adding them unless the benefits are worth it. It will be helpful if you explain the pros/cons of jq and what are your motivations/features this will support

gatzjames avatar Sep 22 '23 08:09 gatzjames

thanks @gatzjames for looking into this. So yeah, maybe this explains better than myself https://github.com/stedolan/jq/wiki/For-JSONPath-users

IMHO, jq resolves many issues as we are currently having with JSONPath also its simplicity and performance are two pros worth mentioning πŸ˜„

kobenguyent avatar Sep 22 '23 08:09 kobenguyent

Ping, I'm really excited about this feature and can’t wait to see it in action!

smartrejames avatar May 01 '24 07:05 smartrejames

Closing as including jq in creates many issues with bundling

gatzjames avatar Jul 12 '24 11:07 gatzjames