Fieldtype to get array of objects

Hello,

I would like to get array of objects in this format:

“questions”: [
{ “id”: 1, “label”: “First Question” },
{ “id”: 2, “label”: “Second Question” },
{ “id”: 3, “label”: “Third Question” }
]

I use Repeater or Set format but none of these is appropriate.
Can you tell me which type of filed should I use and how to configure it?

Thank you!

I’m not aware of any core field, that has this beautiful, clean data structure. I wrote a field “simple-repeater”, that serves exactly your purpose. It wasn’t compatible with set fields (and I only tested it with text fields in the past), but I fixed it and now it should work as expected.

Field options:

name: questions
type: simple-repeater
options:

{
  "field": {
    "type": "set",
    "label": "question",
    "options": {
      "fields": [
        {
          "type": "text",
          "name": "id",
          "options": {
            "type": "number"
          }
        },
        {
          "type": "text",
          "name": "label"
        }
      ]
    }
  }
}

Custom field:

Usage: