<?php json_last_error_msg(): string
<?php $encoded = json_encode($value); if (json_last_error() !== JSON_ERROR_NONE) { throw ConversionException::conversionFailedSerialization($value, 'json', json_last_error_msg()); } return $encoded;