JsonPathElement
class JsonPathElement
Simple JsonPath Reader/Writer Attention: This reader/writer only supports the basic parent/child syntax and is not intended to support more All existing PHP libraries for JSONPath are buggy, to not properly use object base json_decode (leading to errors) or do not support writing of elements
Methods
Create a JsonPathElement Object
Returns the elements matching the provided path as JsonPathElement Object to allow modifications
Retuns the current state as JSON String
Returns the FIRST value of the passed JSONPath
No description
Replace the full element
Set a JSON element value to the specified value {a: {b: 'Test'}} --> setValue('$.a', 'b', 'Test')
No description
Details
at line 20
__construct($jsonObjectOrString = null)
Create a JsonPathElement Object
at line 59
array
getElements($jsonPath)
Returns the elements matching the provided path as JsonPathElement Object to allow modifications
at line 108
string|null
getJson(bool $returnEmptyAsJson = false)
Retuns the current state as JSON String
at line 40
mixed
getValue($jsonPath)
Returns the FIRST value of the passed JSONPath
at line 74
void
remove($jsonPath, $valueKey)
No description
at line 326
JsonPathElement
replaceJsonObject($jsonObjectOrString = null)
Replace the full element
at line 92
void
setValue($jsonPath, $valueKey, $newValue)
Set a JSON element value to the specified value {a: {b: 'Test'}} --> setValue('$.a', 'b', 'Test')
at line 252
static
test()
No description