json-prune
The
json-prune
snippet traps calls to JSON.parse
. If the result of the parsing is an object, the snippet removes the specified properties from the result before returning to the caller. Use
json-prune
when you want to remove properties from an object parsed with JSON.parse.
Name | Description | Mandatory |
---|---|---|
rawPrunePaths | A list of space-separated properties to remove. | Yes |
rawNeedlePaths | A list of space-separated properties. All must be present for pruning to occur. | No |
The following table lists examples that use the
json-override
snippet:Filter | Result |
---|---|
json-prune ads | Removes any ads property (if found) from every object parsed with JSON.parse . |
json-prune 'ads videoAds' | Removes all ads and videoAds properties (if found) from every object parsed with JSON.parse . |
json-prune ads userId | Removes any ads property (if found) from every object parsed with JSON.parse with a userId property. |
json-prune 'ads videoAds' userId | Removes all ads and videoAds properties (if found) from every object parsed with JSON.parse with a userId property. |
json-prune 'ads videoAds' 'userId title' | Removes all ads and videoAds properties (if found) from every object parsed with JSON.parse that has both userId and title properties. |
The following table contains messages you'll find useful during debugging:
Message | When the message occurs | Definition |
---|---|---|
Wrapped JSON.parse | After JSON.parse has been wrapped | The snippet was injected and the API was wrapped. |
Found <<rawOverridePath>> and deleted | After a property was deleted. | A property was found and deleted. If rawOverridePaths has multiple paths, you'll see a message for each found path. |
Last modified 3mo ago