I have a JSON object as follows:
{u'2015-05-11': 2, u'2015-05-04': 1}
Here the dates can vary, i.e., I can query for multiple dates.
I want to extract the numbers in the object and add them. So in this example I want to extract 2
and 1
and them up to get the result 3
.
Another example:
{u'2015-05-11': 6, u'2015-05-04': 0}
Here the answer will be 6 + 0 = 6
.
Another example of the JSON object with multiple dates:
{u'2015-04-27': 0, u'2015-05-11': 2, u'2015-05-04': 1}
Here the answer will be: 0 + 2 + 1 = 3
I want to loop through the JSON object and extract all the numbers. I've read the answers provided here and here. The problem is the, the JSON object that I have does not have a fixed key that I can query.
How do I go about this?