Proxyman
Proxyman copied to clipboard
Feature request: live filtering of json with jq syntax
jq is a useful tool for filtering json. It would be a nice improvement to be able to filter down json response bodies by entering a short jq query string.
Hi, I suppose that when we support Scripting feature, it's good place to use jq as your need.
Basically, you can add JS script for filtering the content or Script to manipulate the Request/Response automatically.
Hi. I looove proxyman already. But with jq... boy would that be awesome!! Is this on the backlog? 🥺
@humblehacker @nunogoncalves, It looks like jq syntax is similar to JSONPath, which Proxyman is already supported 👍
Reference: https://docs.proxyman.io/basic-features/jsonpaths
Oh! That's great! Thank you!
I never worked with JSONpath. But it look like it supports my main usecase which is filtering by multiple values. :)
Not wanting to be a pain in the ass, and sound ungrateful (trust me, I'm not :D I really love Proxyman - you make a fantastic job with this), would you mind still considering adding jq support? I mean, I'm much more used to it and probably there's more people out that on the same boat.
@nunogoncalves From what I understand, jq and JSONPath are really similar. It also allows you to filter multiple values.
Since it might take time to implement the native jq lib (I did google, and unfortunately, there are no swift wrapper), I guess you should take a look at JSONPath example: https://docs.proxyman.io/basic-features/jsonpaths#path-examples
If it still doesn't fit you, can you give me some jq examples? I will find a way to translate it to JSONPath. I guess it can be simpler 😄
I was trying with JSONPath the following example which I can't seem to transport to JSONPath. But obviously it's a tool I just started playing with and I probably only couldn't find yet.
A simple example I was trying: Given the following json:
[
{
"id": 1,
"name": "Store A",
"address": {
"city": {
"id": 112,
"name": "Lisbon"
},
"country": {
"id": 101,
"name": "Portugal"
}
}
},
{
"id": 2,
"name": "Store B",
"address": {
"city": {
"id": 112,
"name": "Paris"
},
"country": {
"id": 101,
"name": "France"
}
}
}
]
with the following jq query
[.[] | { name: .name, city: .address.city.name, country: .address.country.name }]
we would get:
[
{
"name": "Store A",
"city": "Lisbon",
"country": "Portugal"
}, {
"name": "Store B",
"city": "Paris",
"country": "France"
}
]
Thank you so much for your help.