json-override
Last updated
Last updated
The json-override
snippet wraps JSON.parse
to override values from the same list as override-property-read
.
Name | Description | Mandatory |
---|---|---|
Value | Definition |
---|---|
The following table lists examples that use the json-override
snippet:
The following table contains messages you'll find useful during debugging:
Filter | Result |
---|---|
Message | When the message occurs | Definition |
---|---|---|
rawOverridePaths
A list of space-separated properties to remove. It also accepts property chains, like foo.bar.tar
.
Yes
value
The value to override the property with.
Yes
rawNeedlePaths
A list of space-separated properties. All must be present for pruning to occur. Also accepts property chains.
No
filter
A string to look for in the raw string, before it's passed to JSON.parse
. If no match is found, no further search is done on the resulting object.
If the string begins and ends with a slash (/
), the text in between is treated as a regular expression.
No
undefined
false
true
null
" "
An empty string
decimal integer
noopFunc
A function with an empty body
trueFunc
A function that returns true
emptyArray
An array with no elements
emptyObj
An object with no properties
json-override ghl_label ''
Replaces the ghl_label
property value (if found) with an empty string from every object parsed with JSON.parse
.
json-override 'children text' ''
Replaces all children
and text
property values (if found) with an empty string from every object parsed with JSON.parse
.
json-override ghl_label '' text
Replaces any ghl_label
property value (if found) with an empty string from every object that has a text
property and is parsed with JSON.parse
.
json-override 'children text' '' 'styles tag'
Replaces all children
and text
property values (if found) from every object that has both the styles and tag properties and is parsed with JSON.parse
.
json-override ghl_label.children '' '' 'test'
Replaces the children
sub-property value of a ghl_label
property (if found) with an empty string only if the raw string contains test
from every object that is parsed with JSON.parse.
Wrapped JSON.parse
After JSON.parse
has been wrapped
The snippet was injected and the API was wrapped.
Found <<rawOverridePath>> replaced it with <<value>>
After a property was overridden.
A property was found and overridden. If rawOverridePaths
has multiple paths, you'll see a message for each found path.