# Mapping a \[string\] for one-to-many import

**URL:** <https://connective.celigo.com/t/mapping-a-string-for-one-to-many-import/1003>\
**Category:** Integrator.io\
**Tags:** transformation, mapper, import\
**Created:** [November 20, 2024, 3:55am UTC](https://connective.celigo.com/t/mapping-a-string-for-one-to-many-import/1003 "2024-11-20T03:55:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![daveguderian](https://avatars.discourse-cdn.com/v4/letter/d/ce7236/32.png) [@daveguderian](https://connective.celigo.com/u/daveguderian)\
**Post date:** [November 20, 2024, 3:55am UTC](https://connective.celigo.com/t/mapping-a-string-for-one-to-many-import/1003/1 "2024-11-20T03:55:25Z")

</div>

I am a little confused on how to map a string array for a one to many import. I have several string arrays coming from in my payload and wasn't clear on what my transformation should look like. I was also wondering if I can “bundle” them (string arrays) all together under one object array for a single one-to-many import or if each would need its own object array (and thus its own one-to-many import step).

Sample Transformation of what I would like to do (Again assuming everything can be bundled into one object array).

 ![5301043caa20740200000001-8bb38dc85cd74346bd2aed0ba976a721.png](https://us1.discourse-cdn.com/flex001/uploads/celigo/original/2X/5/5b65d3914ac9f9219f0d6221c78cafe3db3c95a2.png)

Sample of Licensed States in my original payload:

```
"InWhatStatesDoYouHoldAnActiveInsuranceLicense": [
   "Alabama",
   "Alaska",
   "Arizona",
   "Arkansas",
   "Maryland",
   "Nebraska"
 ],
```

Sample output from my transformation above:

```
  "ProductsAndLicensedStates": [
   {
     "LicensedStates": [
       "Alabama",
       "Alaska",
       "Arizona",
       "Arkansas",
       "Maryland",
       "Nebraska"
     ],
     "SellingToAccountTypes": [
       "Groups",
       "Individuals"
     ],
     "SellingProductTypes": [
       "Major Medical",
       "ClearShare"
     ],
     "SellingOtherProductTypes": [
       "Supplementals",
       "Direct Primary Care"
     ]
   }
 ],
```

---

<div class="post-metadata">

**Author:** ![tylerlamparter](https://sea1.discourse-cdn.com/flex001/user_avatar/connective.celigo.com/tylerlamparter/32/9204_2.png) [@tylerlamparter](https://connective.celigo.com/u/tylerlamparter)\
**Post date:** [November 20, 2024, 4:11am UTC](https://connective.celigo.com/t/mapping-a-string-for-one-to-many-import/1003/2 "2024-11-20T04:11:36Z")

</div>

@daveguderian I'm confused what you would like your output to be. Can you provide a sample desired output?

---

<div class="post-metadata">

**Author:** ![daveguderian](https://avatars.discourse-cdn.com/v4/letter/d/ce7236/32.png) [@daveguderian](https://connective.celigo.com/u/daveguderian)\
**Post date:** [November 20, 2024, 2:30pm UTC](https://connective.celigo.com/t/mapping-a-string-for-one-to-many-import/1003/3 "2024-11-20T14:30:42Z")

</div>

@tylerlamparter - Basically, I just want to know how to structure the transformation so that I can loop through the arrays in the ProductsAndLicensedStates Object so that I can use One to Many (again not sure if each one needs to be split into its own object or I can use one object (i.e. ProductsAndLicensedStates) and bundle all of them).

Below is a screenshot showing the Licensed States in SF. The other three fields (SellingToAccountTypes, SellingProductTypes, SellingOtherProductTypes) are a similar set-up in SF.

 ![5301043caa20740200000001-8e211db62caf488c8ea50b2c1ea65926.png](https://us1.discourse-cdn.com/flex001/uploads/celigo/original/2X/a/ae901fc4ae641bc704ba5e3802b3ae16139d9f59.png)

---

<div class="post-metadata">

**Author:** ![tylerlamparter](https://sea1.discourse-cdn.com/flex001/user_avatar/connective.celigo.com/tylerlamparter/32/9204_2.png) [@tylerlamparter](https://connective.celigo.com/u/tylerlamparter)\
**Post date:** [November 20, 2024, 6:58pm UTC](https://connective.celigo.com/t/mapping-a-string-for-one-to-many-import/1003/4 "2024-11-20T18:58:25Z")

</div>

@daveguderian so you want to transform on an export step so that subsequent imports/lookups can loop through all of these? The one-to-many for imports/lookups do not work with string arrays, so you would have to make this a normal object array. However, you can't use transformation/mapper to map a string array to an object array. You can use transformation/mapper to combine string arrays into a single string array, like this, but since one-to-many doesn't support string arrays, this wouldn't help.

 ![5301043caa20740200000001-426c1fc60c9544ada2beaf29e34b9aca.png](https://us1.discourse-cdn.com/flex001/uploads/celigo/original/2X/4/4e4cf319883727033d30c97f2b0939f2b5a8316e.png)

What you're left doing is using a preSavePage or a transformation script to convert all these string arrays to a single object array that can then be used for one-to-many. I would try using Celigo AI to build the script for you. Put a prompt in like: “combine the stringarray1 and stringarray2 fields into a single object array that has the structure like [{key:value}] where the key is just hardcoded to "key" and the value is each value in the string arrays”.

 ![5301043caa20740200000001-7eda3536bb7d4e1785751eefdf44630a.png](https://us1.discourse-cdn.com/flex001/uploads/celigo/original/2X/4/45d94ed96d3b1e0e5bc03501378bfb8c7a45af7b.png)
