Loop through metaobject entries

In my store I have a brand metaobject whose entries have a name and image. I would like to list all the brands in the store in my theme, but I can’t get the list of entries.

Here’s what I tried based on the documentation of these objects and chatGPT help:

{% assign brands = shop.metaobjects.custom.brand %}
{% assign mobjects = shop.metaobjects %}

{{ mobjects | json }}


{{ brands | json }}


  {% for brand in brands %}
    - {{ brand.name.value }}
    
  {% endfor %}

**mobjects** in the

 element returns {“error”:“json not allowed for this object”}, and **brands** returns null - that’s why no items appear in my list.

Thank you in advance for your help and I apologize if my problem is due to an omission in the documentation.

Sorry for the confusion, as I thought I missed some of the documentation: Metaobject definition (Loop over entries of a metaobject definition)