Hi @Louis_kwok, I think you can approach this similar to what I’ve described earlier in Count occurrences of each item in JSON - #15 by MutedJam, just a bit simpler.
Here’s an example using your data:
Returning this result:
Is this what you were looking for?
If you’re using an older version of n8n (< 0.166.0) you might need to wrap the result in the required data structure, but for up to date versions it should work out of the box without having to make changes.