src/Payload.php
public static function fromJson($json)
    {
        $data = json_decode((string)$json, true);

        if (json_last_error() !== JSON_ERROR_NONE || !is_array($data)) {
            throw new \UnexpectedValueException('Invalid JSON message.');
        }

        return new static($data);
    }
public static function fromJson($json)
    {
        $data = json_decode((string)$json, true);

        if (json_last_error() !== JSON_ERROR_NONE || !is_array($data)) {
            throw new \UnexpectedValueException('Invalid JSON message.');
        }

        return new static($data);
    }
public static function fromJson ( $ json ) { $ data = json_decode ( ( string ) $ json , true ) ; if ( json_last_error ( ) !== JSON_ERROR_NONE || ! is_array ( $ data ) ) { throw new \ UnexpectedValueException ( 'Invalid JSON message.' ) ; } return new static ( $ data ) ; }
Creates a response object from a JSON message.

@param string $json A JSON string.

@return Response The parsed response.
Creates a response object from a JSON message .