I am working on developing a function that accepts a string as its first argument and a JSON LIST as its second argument:
[
{
"date": "09/09/18",
"how_many": 11,
"species": "XXXXX"
},
{
"date": "04/11/17",
"how_many": 41,
"species": "TTTTTT"
},
{
"date": "17/03/18",
"how_many": 30,
"species": "DDDDDDDD"
},
{
"date": "17/08/18",
"how_many": 31,
"species": "XXXXX"
},
]
If the input string matches with any of the values under "species" key in each JSON entry, it will calculate the number of occurrences.
In simple terms, I need to create a function that counts how many times the input string appears in the list of objects based on the value of the "species" key.