How to create dynamic group from json?

Hello Sir,
I want to create like below from server.

$scope.groups = [ { name: 'Bun ', id: 1, items: [{ subName: ‘Tomato’ },{ subName: ‘Bean’ }]},{ name: 'Cheses ', id: 2, items: [{ subName: ‘American Chease’ }]}]

How to do it from server response?