1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-01 02:02:29 +02:00

JSON.prune new properties: [-], {-}

gwarser 2024-04-11 14:06:39 +02:00
parent 84746719c0
commit 38392562e1

@ -382,7 +382,7 @@ A property in a list of properties can be a chain of properties, example: `adpat
After [1.28.0](https://github.com/gorhill/uBlock/commit/f433932d8602230539d3408e9946d4d70b40306c), two special _"wildcard tokens"_ have been added:
- `[]` - will iterate in all elements in an array. To deal with cases where the
- `[]`: iterate in all elements in an array. To deal with cases where the
property to remove is an element in an array.
To remove `adserver` object properties from array in following JSON payload:
@ -392,7 +392,7 @@ property to remove is an element in an array.
+js(json-prune, playlist.[].adserver)
- `*` - will iterate through all own properties of an object. For example, to deal with hard to predict random-named properties.
- `*`: will iterate through all own properties of an object. For example, to deal with hard to predict random-named properties.
To remove `adserver` object properties from inside _randomly named_ objects in following JSON payload:
{"playlist": {"random1": {"adserver": "first"}, "randomB": {"adserver": "second"}}}
@ -401,6 +401,12 @@ property to remove is an element in an array.
+js(json-prune, playlist.*.adserver)
Version [1.57.0](https://github.com/gorhill/uBlock/commit/e7a0f8c7810c002bc7cec6a1160f8b091f8ea52e) extend syntax with two special token properties:
- `[-]`: remove an array entry if part right of `[-]` matches the
inspected item.
- `{-}`: remove a property if part right of `{-}` mmatches the
inspected item.
When used without parameters, will log current hostname + json payload to the console.
New in [1.27.0](https://github.com/gorhill/uBlock/commit/578594bbd7c545b62f18267d640a605f8e07a53a) - second parameter can be used to limit logging to JSON payloads which stringified content match specified string or _regular expression_.