i need to count the number of occurrences of values in jsonArray items in javascript.
consider this as my jsonArray:
{"name":"jack","age":23},
{"name":"john","age":20},
{"name":"alison","age":23},
{"name":"steve","age":25},
.
.
.
now for example i need to know how many times each age is repeated in this array, i want to count each value for each property, i mean i need a result like this :
name : {"jack" : 2,"james" : 10,"john" : 1,....}
age : {"23":10,"20":15,"25":2,....}
what is the simplest way to achieve this?
EDIT : my array is very big and i don't want to call count function for each value. i want a code to count each value repeat times.