objectList json to array

Hi! How to use objectList in a component?

class Items extends \Cms\Classes\ComponentBase {
    public function componentDetails() {
        return [
            'name' => 'Items',
        ];
    }

    public function defineProperties() {
        return [
            'items' => [
                'title' => 'Name',
                'type' => 'objectList',
                'titleProperty' => 'text',
                'itemProperties' => [
                    'text' => [
                        'title' => 'Text',
                        'type' => 'string',
                        'required' => true,
                    ],
                    'url' => [
                        'title' => 'Url',
                        'type' => 'string'
                    ]
                ]
            ]
        ]
    }
}

Nothing shows up when I use it:

{% set items = __SELF__.property('items') %}

{% for item in items %}
   {{ item.text }}
{% endfor %}

When I use {{items}} it shows this:

json:%5B%7B%22text%22%3A%22Loremipsum....

Can someone explain how to make this work?

Hi @Radek

In what context are you using this, is it working with snippets?

@daft it doesn’t work with snippets on static pages, it only works on regular pages as a component

1 Like

Oh yes, I see it.

It looks like a minor bug. We will fix it in the next patch (v3.4.7)

1 Like

Thank you, this also applies to other fields e.g. “set” and “object”