-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Improve 'json-prune' — match key with specific value, remove array or object if it contains specific item #183
Comments
@slavaleleka what do you think about implementing a scriptlet that supports Alternatively, there is this: https://jmespath.org/ I do not suggest supporting it fully, but we could take that syntax as a base and build our limited subset of it. This way it'd be easier for the scriptlet users to understand the capabilities. PS: we'll probably need to reassign this task to a later milestone. |
json-prune
or implement new scriptlet
No description provided. |
@ngorskikh the spec should've been posted here I think: AdguardTeam/CoreLibs#1447 We'll also need a filter expression for checking whether the value contains the specified string: |
Currently, Example: Gmarket.co.krURL: https://gmarket.co.kr/ |
Could you please explain what you're trying to do with that request? Do you need to block a request that contains such a JSON path? |
#183 (comment) |
So you'd like a scriptlet alternative to |
Yes. |
Makes sense, Moved it to Scriptlets v1.9 for now. @slavaleleka @stanislav-atr what do you think about it? To understand better what's required please check out this issue in CL: AdguardTeam/CoreLibs#1447 |
we shall return to the issue later |
json-prune
or implement new scriptlet
|
the same is needed in scriptlets as well: UPD: |
second issue in first issue post cannot be fixed in current syntax implementation — |
@slavaleleka not sure what you mean, aren't filter expressions supposed to solve this? |
I couldn't figure out how we can handle JSONP requests, apart from one method. For example, let's say there's a JSONP callback like this: ...
<script>
function handleResponse(data) {
console.log(JSON.stringify(data));
}
</script>
<script src="http://server.com/jsonp?callback=handleResponse"></script>
... We can find the matching callback function from the page and proxify the call to it. |
Probably jsonp shouldn't be in scope of this issue since there's no clear solution. |
Please take a look for |
Another case |
Squashed commit of the following: commit 24b1ee3 Merge: 9c5488c 1324cfa Author: Adam Wróblewski <adam@adguard.com> Date: Mon Feb 10 13:55:44 2025 +0100 Merge branch 'master' into feature/AG-12363 commit 9c5488c Author: Adam Wróblewski <adam@adguard.com> Date: Mon Feb 10 13:52:41 2025 +0100 Remove some tests from json-prune.test.js commit 38495b1 Author: Adam Wróblewski <adam@adguard.com> Date: Mon Feb 10 13:51:22 2025 +0100 Add unit tests commit b1e6941 Author: Adam Wróblewski <adam@adguard.com> Date: Mon Feb 3 16:14:35 2025 +0100 Update JSDoc commit 950dac0 Author: Adam Wróblewski <adam@adguard.com> Date: Mon Feb 3 15:55:34 2025 +0100 Fix splitting props which have regex with spaces as value to match Add tests commit dd352d9 Author: Adam Wróblewski <adam@adguard.com> Date: Mon Feb 3 14:16:56 2025 +0100 Fix typo prunned -> pruned commit 954e534 Author: Adam Wróblewski <adam@adguard.com> Date: Mon Jan 27 09:10:00 2025 +0100 Revert unnecessary changes commit 3eb6d9e Author: Adam Wróblewski <adam@adguard.com> Date: Mon Jan 27 08:16:32 2025 +0100 Add test commit 8944822 Author: Adam Wróblewski <adam@adguard.com> Date: Sun Jan 26 17:38:46 2025 +0100 Use splice instead of delete operator when removing elements from array Update changelog Add examples to documentation commit a9221b3 Author: Adam Wróblewski <adam@adguard.com> Date: Sat Jan 25 16:47:16 2025 +0100 Export isKeyInObject Check type of the removed element Add more tests commit 3bdf055 Author: Adam Wróblewski <adam@adguard.com> Date: Sat Jan 25 01:41:43 2025 +0100 Improve json-prune Add ability to remove property and array if it matches specified item And add ability to prune object only when it match specific value
there are few issues:
1 current json-prune does not match values if we need specify pruning, only keys —
obligatoryProps
— are checked2 if specific array item has to be pruned and we can target such items by their extra fields
but whole
recs_group.[].tiles.[].[]
array items will be pruned, not just ones withad_origin
.check on fontanka.ru
https://uploads.adguard.com/slbdzdrv7cfxo.png
The text was updated successfully, but these errors were encountered: