I've tried to find an answer but was not successful.

The sample of json data, lets say it would be named **mainArray**:

```
[{
  "id": 4455,
  "key1": 44,
  "key2": 55
},
{
  "id": 1122,
  "key1": 11,
  "key2": 22
}]

```

The sample of data **nestedArray** needs to be added in **mainArray**:

```
[{
  "nestedkey0": 'Value0',
  "nestedkey1": "Value1",
  "nestedkey2": "Value2"
},
{
  "nestedkey0": "Value3",
  "nestedkey1": "Value4",
  "nestedkey2": "Value5"
}]

```

And we have to check if "id" key (in **mainArray**) equals "specificId" variable:

```
 var specificId = 4455;

```

In case they are equal — we need to add **nestedArray** into the object of **mainArray** as a new key with list of objects, so returned result should be like this:

```
[{
  "id": 4455,
  "newKey": [{
      "nestedkey0": 'Value0',
      "nestedkey1": "Value1",
      "nestedkey2": "Value2"
    },
    {
      "nestedkey0": "Value3",
      "nestedkey1": "Value4",
      "nestedkey2": "Value5"
    }];
  "key1": 44,
  "key2": 55
},
{
  "id": 1122,
  "key1": 11,
  "key2": 22
}];

```

Here's a sample of code on Plunker:
<https://plnkr.co/edit/YJ3lTbleKrBJBaJm7VwU?p=preview>

I've got a feeling that shouldn't be hard, but I'm not quite experienced in angularjs to resolve this task.
Thank you in advance for your answers!

**Update**

Updated code in Plunker with answer of **Nina Scholz** (link is above)

And another solution from **Halcyon**

<http://jsbin.com/xaxagusuma/edit?html,js,console,output>

Thanks to all for your help!