Multiselect field "Invalid options format"

Hi there,

I’m trying to use the API property of the multi select field but I keep getting the following error.

“Invalid options format”

There is no error in the console. Can you advise how I might get a more verbose error message? Currently this one is extremely vague.

This is what the entry looks like in my blueprint

        label: Genres for the mix
        type: multiselect
        options: api
          fetch: Genres
          text: "{{ item.Name }}"
          value: "{{ item.Name.slug }}"

I’ve scaled down the the url to just return a JSON object with a single item…

Any advice on this would be appreciated!

I couldn’t see item.Name.slug index. Did you try Parent index like: value: "{{ item.Parent }}"?

I made a fetch request and confirmed the error is caused by a cross origin issue, it seems, at least when I test from my server. Are you testing this locally or on the same server?

(Sorry, German error message)

So, in case this is your issue, either try from the same source or set the CORS header.

The genres.json exists in the root directory of the same server as my kirby panel. Would setting a CORS header help in this case?

That’s what I would expect.

Managed to solve this! My JSON file was showing a syntax error but when I ran it through JSON lint it passed fine. It turned out that my genres.json file was encoded as UTF-BOM not UTF-8 … once I changed it to UTF-8 the API worked.