# Array of strings - strings defined by other JSON fields

**URL:** <https://jsonforms.discourse.group/t/array-of-strings-strings-defined-by-other-json-fields/616>\
**Category:** General\
**Created:** [February 18, 2022, 9:15pm UTC](https://jsonforms.discourse.group/t/array-of-strings-strings-defined-by-other-json-fields/616 "2022-02-18T21:15:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kris](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/kris/32/254_2.png) [@kris](https://jsonforms.discourse.group/u/kris)\
**Post date:** [February 18, 2022, 9:15pm UTC](https://jsonforms.discourse.group/t/array-of-strings-strings-defined-by-other-json-fields/616/1 "2022-02-18T21:15:23Z")

</div>

Assuming I have a JSON that looks like this:

```auto
{
   "name" : [
       { "First": "Bob", "Last": "Jones" },
       { "First": "Sally", "Last":"Smith" }
  ],
   "FirstNames" : []
}

```

I just used jsonforms to populate the _name_ array.

Now, I want jsonforms to offer me a list of name.FirstName when populating the FirstNames array.

I can easily create the array of first names ( `let fn = names.map((n)=> return n.First)` ), do I use a jsonforms custom renderer to supply those options when populating FirstNames?

---

<div class="post-metadata">

**Author:** ![sdirix](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/sdirix/32/1073_2.png) [@sdirix](https://jsonforms.discourse.group/u/sdirix)\
**Post date:** [February 21, 2022, 10:35am UTC](https://jsonforms.discourse.group/t/array-of-strings-strings-defined-by-other-json-fields/616/2 "2022-02-21T10:35:22Z")

</div>

Hi @kris,

JSON Schema is not expressive enough to formulate your requirements. The way to go is to use a custom renderer `FirstNames` which looks up the data for `name` in the form and only offers the options you’d like to see.

You can even mostly reuse the existing enum renderers here but just hand them over your custom options.

---

<div class="post-metadata">

**Author:** ![kris](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/kris/32/254_2.png) [@kris](https://jsonforms.discourse.group/u/kris)\
**Post date:** [February 22, 2022, 7:00pm UTC](https://jsonforms.discourse.group/t/array-of-strings-strings-defined-by-other-json-fields/616/3 "2022-02-22T19:00:12Z")

</div>

@sdirix

Thanks Stefan.

It looks like MaterialArrayControlRenderer isn’t exposed as “Unwrapped” (enum doesn’t work since I need people to select more than one)

Do you have any examples of how to use MaterialArrayControlRenderer as a custom renderer?

I think my first step in figuring this out is to duplicate the existing renderer as a custom renderer with my own tester. I can’t seem to get that far yet 🙂

Second step would be to figure out how to pass in the existing data/state.

Any additional pointers?  
Thanks!

---

<div class="post-metadata">

**Author:** ![sdirix](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/sdirix/32/1073_2.png) [@sdirix](https://jsonforms.discourse.group/u/sdirix)\
**Post date:** [February 23, 2022, 7:38am UTC](https://jsonforms.discourse.group/t/array-of-strings-strings-defined-by-other-json-fields/616/4 "2022-02-23T07:38:07Z")

</div>

Hi @kris,

The `MaterialArrayControlRenderer` is way too overkill for this use case. You will have a better experience when implementing a new custom renderer. For selecting multiple elements from an array we have the currently undocumented [MaterialEnumArrayRenderer](https://github.com/eclipsesource/jsonforms/blob/d65d7eb8a5050c6de7a4e086e01237bd2488f64c/packages/material/src/complex/MaterialEnumArrayRenderer.tsx). You can use this code as a guideline for your renderer.

An example to trigger this renderer is [here](https://github.com/eclipsesource/jsonforms/blob/81f1f19dac49b1864e712e9abbc5c5c6355a2b91/packages/examples/src/examples/multi-enum.ts).
