class JsonSerializer

Class responsible for populating the JSON body of a {see GuzzleHttp\Message\Request} object.

Methods

stockJson (Parameter $param, mixed $userValue, array $json) : array

A generic method that will populate a JSON structure with a value according to a schema. It supports multiple types and will delegate accordingly.

Details

stockJson(Parameter $param, mixed $userValue, array $json)

A generic method that will populate a JSON structure with a value according to a schema. It supports multiple types and will delegate accordingly.

Parameters

$param Parameter The schema that defines how the JSON field is being populated
$userValue mixed The user value that is populating a JSON field
$json array The existing JSON structure that will be populated

Return value

array

Example code

$array = $jsonSerializer->stockJson($param, $userValue, $json);