src/Exception/ValidationException.php
public function jsonSerialize()
    {
        $result = ['message' => $this->getMessage(), 'type' => get_class($this), 'field_errors' => []];

        foreach ($this->getErrors() as $field => $messages) {
            foreach ($messages as $message) {
                if (empty($result['field_errors'][$field])) {
                    $result['field_errors'][$field] = [];
                }

                $result['field_errors'][$field][] = $message;
            }
        }

        if ($this->object instanceof EntityInterface) {
            $result['object_class'] = get_class($this->object);
        }

        return $result;
    }
public function jsonSerialize()
    {
        $result = ['message' => $this->getMessage(), 'type' => get_class($this), 'field_errors' => []];

        foreach ($this->getErrors() as $field => $messages) {
            foreach ($messages as $message) {
                if (empty($result['field_errors'][$field])) {
                    $result['field_errors'][$field] = [];
                }

                $result['field_errors'][$field][] = $message;
            }
        }

        if ($this->object instanceof EntityInterface) {
            $result['object_class'] = get_class($this->object);
        }

        return $result;
    }
Return array or property => value pairs that describes this object.
@return array