json-override

json-override

The json-override snippet wraps JSON.parse to override values from the same list as override-property-read.

Parameters

Name

Description

Mandatory

rawOverridePaths

Space-separated properties to remove. Accepts property chains (foo.bar), {} for objects, [] for arrays.

Yes

value

The value to override the property with.

Yes

rawNeedlePaths

Space-separated properties — all must be present for override to occur.

No

filter

String or regex to look for in the raw string before JSON.parse. If no match, no further search is done.

No

Possible override values

Value

Definition

undefined


false


true


null


" "

Empty string

decimal integer


noopFunc

Function with empty body

trueFunc

Function returning true

emptyArray

Array with no elements

emptyObj

Object with no properties

Filter examples

Filter

Result

json-override ghl_label ''

Replaces ghl_label with empty string from every object parsed with JSON.parse.

json-override 'children text' ''

Replaces all children and text properties with empty string.

json-override ghl_label '' text

Replaces ghl_label from every object that has a text property.

json-override data.nested.[].ad ''

Replaces all ad values listed inside an array with empty string.

json-override data.nested.{}.ad ''

Replaces ad values from any nested object properties.

Debugging

Message

When

Definition

Wrapped JSON.parse

After wrapping

The API was wrapped.

Iterating over array at [] or Iterating over object at {}

Parsing placeholder

The path leading to the placeholder is accurate.

Found <<rawOverridePath>> replaced it with <<value>>

After override

A property was found and overridden.