public function toJson($options = 0)
	{
		$json = json_encode($this->jsonSerialize(), $options);

		if (JSON_ERROR_NONE !== json_last_error()) {
			throw JsonEncodingException::forObject($this, json_last_error_msg());
		}

		return $json;
	}
public function toJson($options = 0)
	{
		$json = json_encode($this->jsonSerialize(), $options);

		if (JSON_ERROR_NONE !== json_last_error()) {
			throw JsonEncodingException::forObject($this, json_last_error_msg());
		}

		return $json;
	}
public function toJson ( $ options = 0 ) { $ json = json_encode ( $ this -> jsonSerialize ( ) , $ options ) ; if ( JSON_ERROR_NONE !== json_last_error ( ) ) { throw JsonEncodingException :: forObject ( $ this , json_last_error_msg ( ) ) ; } return $ json ; }
Convert the object instance to JSON.

@param int $options
@return string

@throws JsonEncodingException
Convert the object instance to JSON .