# How to join a key and value pair in an object

**URL:** <https://community.synatic.com/t/how-to-join-a-key-and-value-pair-in-an-object/164>\
**Category:** Calculators\
**Tags:** calculator, helper-functions\
**Created:** [January 7, 2022, 4:41pm UTC](https://community.synatic.com/t/how-to-join-a-key-and-value-pair-in-an-object/164 "2022-01-07T16:41:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![navessa](https://yyz2.discourse-cdn.com/flex032/user_avatar/community.synatic.com/navessa/32/58_2.png) [@navessa](https://community.synatic.com/u/navessa)\
**Post date:** [January 7, 2022, 4:41pm UTC](https://community.synatic.com/t/how-to-join-a-key-and-value-pair-in-an-object/164/1 "2022-01-07T16:41:58Z")

</div>

The below image is an example of a flow where a Record Generator step is used as a source step.

 ![image](https://canada1.discourse-cdn.com/flex032/uploads/synatic/original/1X/2c87a74d4036e65a8ef19079d3ac57ef42a70097.png)

In the Record Generator step, it is populated with a data load as per the image below.

![image](https://canada1.discourse-cdn.com/flex032/uploads/synatic/original/1X/eaa2918047debbb8a378506130c63a7defc9cfce.png)

Illustrated in the image below is the output of the data load when testing the Record Generator step.

 ![image](https://canada1.discourse-cdn.com/flex032/uploads/synatic/original/1X/4153b8e35ddabb0ba47accee9cb81561adcbaf3e.png)

The image below contains the code in the calculator step that is used to join a key and value pair in an object.

![image](https://canada1.discourse-cdn.com/flex032/uploads/synatic/original/1X/c8eaddd44d2ddc9bb87485e03d5b4417fc689e0e.png)

Copy and paste the below code in your calculator step:

let inputRecord=input.record;

let newObj={};

for (let k in inputRecord.data)  
{  
newObj[k]=inputRecord.data[k].value;  
}

inputRecord.Answers = newObj;  
return inputRecord

Highlighted in the below image is the new object “Answers” that was created which contains the output/ results of the value being paired with a key.

![image](https://canada1.discourse-cdn.com/flex032/uploads/synatic/original/1X/bf8cdc69a226d9cf4465176987dcd4c43dd5746a.png)
