An item with the same key has already been added error

Hi All,

I am working on a workflow in which i would need to take values from a datatable and update it in the existing JSON.
I am facing the error “An item with the same key has already been added”. The error is at the assign activity where it is assigning to Dictionary. I understand that Keys in a Dictionary are unique but in my process I would require both the keys. Can you suggest on what modification to be done at the assign activity or at the Invoke to resolve the issue ?

Please find the attached Sample JSON and XAML.

can you tell me which key is repeating

The key which is repeating is “gr1”.

can you use like gr2 or something ??
if not then you have to store the gr1 values as array in gr1

Thank for the information.
I put the values as 3,6 for the key gr1 and mapped it using index 0 and 1. Please see the screenshots below:


I am getting multiple errors like
1)“Invoke Method: Unexpected character encountered while parsing value: “. Path ‘’, line 0, position 0.”
error

Could you please help me on how to proceed with these errors?

provide the screenshot in which activity error comes

i think $.id is not the right way to give the path calling from json file

If this is not the right way, could you please give a sample XAML or the information to map the JSON Key and Value