src/Resource/Asset.php
public function jsonSerialize(): array
    {
        $locale = $this->sys->getLocale();
        $asset = [
            'sys' => $this->sys,
            'fields' => [],
        ];

        if (null !== $this->title) {
            $asset['fields']['title'] = $locale
                ? $this->title[$locale]
                : $this->title;
        }

        if (null !== $this->description) {
            $asset['fields']['description'] = $locale
                ? $this->description[$locale]
                : $this->description;
        }

        if (null !== $this->file) {
            $asset['fields']['file'] = $locale
                ? $this->file[$locale]
                : $this->file;
        }

        $asset['fields'] = (object) $asset['fields'];

        return $asset;
    }
public function jsonSerialize(): array
    {
        $locale = $this->sys->getLocale();
        $asset = [
            'sys' => $this->sys,
            'fields' => [],
        ];

        if (null !== $this->title) {
            $asset['fields']['title'] = $locale
                ? $this->title[$locale]
                : $this->title;
        }

        if (null !== $this->description) {
            $asset['fields']['description'] = $locale
                ? $this->description[$locale]
                : $this->description;
        }

        if (null !== $this->file) {
            $asset['fields']['file'] = $locale
                ? $this->file[$locale]
                : $this->file;
        }

        $asset['fields'] = (object) $asset['fields'];

        return $asset;
    }
{@inheritdoc}