class JsonHelper implements ProtectedContextAwareInterface (View source)

JSON helpers for Eel contexts

Methods

string
stringify(mixed $value, array $options = [])

JSON encode the given value

mixed
parse(string $json, bool $associativeArrays = true)

JSON decode the given string

bool
allowsCallOfMethod(string $methodName)

All methods are considered safe

Details

string stringify(mixed $value, array $options = [])

JSON encode the given value

Usage example for options:

Json.stringify(value, ['JSON_UNESCAPED_UNICODE', 'JSON_FORCE_OBJECT'])

Parameters

mixed $value
array $options

Array of option constant names as strings

Return Value

string

mixed parse(string $json, bool $associativeArrays = true)

JSON decode the given string

Parameters

string $json
bool $associativeArrays

Return Value

mixed

bool allowsCallOfMethod(string $methodName)

All methods are considered safe

Parameters

string $methodName

Return Value

bool