[enter image description here](https://i.stack.imgur.com/ZRDlD.png)I have 2 different datagrid, the first DG1 is my item list and DG2 is the item queues for purchased items. My goal is whenever i click an item in DG2, DG1 is also selected with the same name or id. I want to ignore the index because my item queue is different from item list order.

```
private void dgItems_CellClick(object sender, DataGridViewCellEventArgs e)
    {

        int rowindex = dgItems.Rows[e.RowIndex].Index;
        int columnindex = dgItems.Columns[e.ColumnIndex].Index;

        dgItemList.Rows[rowindex].Cells[columnindex].Selected = true;
    }

```
['https://Stackoverflow.com/questions/52738149', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7725975/']
I think the best way is, create an Object corresponding with the JSON's structure and you assign just the data JSON to the Array of the object.

```js
class User{
   id:string;
   username:string;
   firstName:string;
   lastName:string;
   email:string;
   isActive:boolean;
   isSuperviser:boolean;
}
class JSONData{
   user:User;
   role:string
}
 data:JSONData[] = yourJson.data;
```

You adjust the property name in the json data as in your class and you can handle the data correctly and easily, please refer on this link for [more infos](https://www.typescriptlang.org/docs/handbook/classes.html)
No need to convert. It s already json format but you should use array index then set user variable. 

For example : 

```
let user:any = {};
user = this.user[arrayIndex].user;

this.userData["user"] = user
this.userData["role"] = this.user[arrayIndex].role;

```

if you want o get data from json array , you should use array index. 
Like this.

```
let user:any = {};
user = this.user[0].user;
this.userData["role"] = this.user[0].role;

```