public static final function jsonEncode($data, array $options = null): array
    {
        $encoder = new JsonEncoder($options);

        return [$encoder->encode($data), $encoder->hasError()
            ? new EncoderException('JSON Error: '. $encoder->getError()) : null];
    }
public static final function jsonEncode($data, array $options = null): array
    {
        $encoder = new JsonEncoder($options);

        return [$encoder->encode($data), $encoder->hasError()
            ? new EncoderException('JSON Error: '. $encoder->getError()) : null];
    }
public static final function jsonEncode ( $ data , array $ options = null ) : array { $ encoder = new JsonEncoder ( $ options ) ; return [ $ encoder -> encode ( $ data ) , $ encoder -> hasError ( ) ? new EncoderException ( 'JSON Error: ' . $ encoder -> getError ( ) ) : null ] ; }
Json encode.
@param  any        $data
@param  array|null $options
@return array
Json encode .