In C# I'm using Json.net to try and retrieve the sum total of 'buttonPress' where 'minutesStreamed' is over 60.
string json = @"
{
'results': [
{
'buttonPress': 8,
'minutesStreamed': 83
},
{
'buttonPress': 3,
'minutesStreamed': 4
},
{
'buttonPress': 7,
'minutesStreamed': 61
}
]
}";
I did this (below) which retrieves the Sum of the entire column, but I can't find a way to filter out anything where minutesStreamed > 60.
JObject obj = JObject.Parse(json);
var buttonPresses=
from p in obj["results"]
select (int)p["buttonPress"];
int sum = buttonPresses.Sum();
The desired output would be 15 if it works correctly.
Is this even possible?
where ((int)p["minutesStreamed"]) > 60between your from and select lines.