find occurrences count in json object

  json, python, python-3.x
{
        "id": 1,
        "resourceAttributes": {
            "siteId": "100"
        },
},
{
        "id": 2,
        "resourceAttributes": {
            "siteId": "200"
        },
},
{
        "id": 3,
        "resourceAttributes": {
            "siteId": "100"
        },
},

I have this kind of json and as a result I want to show output like this

SiteId100 occurance 2
SiteId200 occurance 1

this out put is on basis of occurrences of site id value like if siteId 100 values occurred in 2 objects I need to show number of occurrences with count. I am trying something like getting all possible site ids and then removing duplicates and then finding one by one but seems that is not a neat solution.

Source: Python Questions

LEAVE A COMMENT