See Group by example in section 126.96.36.199. Changes needed in the query and the response.
In the response, each row should be an object with tag "Row" for the array.
Atoms example is also wrong. Has Atoms as an object with an untagged array inside it. Should just be the array.