Is there a JSON function that we can get a count for certain field/group them by distinct values.

Is there a JSON function so that we can get a count for certain field and group them by distinct values. So the JSON result have the following response:
{
name: John,
name: Kevin,
name: John,
name: Sara,
name: John
} The output should be -
John(3), Kevin,(1),Sara(1)

0 4 217
4 REPLIES 4