I really need Your help! I have a .JSON file that looks something like this:
{
"_id" : { "$yid" : "279e128r" },
"userId" : "245981e3",
"data" : {
"workRate" : 51,
"workStages" : [
{ "quantity" : 33, "value" : "APPLES" },
{ "quantity" : 32, "value" : "PEACH" },
{ "quantity" : 12, "value" : "AVOCADO" },
{ "quantity" : 53, "value" : "APPLES" },
{ "quantity" : 22, "value" : "PEACH" },
{ "quantity" : 27, "value" : "AVOCADO" }
],
"timeInterval" : 25,
"timeSource" : 1
},
"sessionStartTime" : 1494311320,
"sessionEndTime" : 1494336640
}
There are around 500 id ("_id") with 30 participants ("userId").
So I want to take the existing JSON data, and create a new Array that has only 30 Objects ( each object for each participant ) and then find the "data" field and count up the times that vegetables were mentioned, and combine them, and have the number of times that it was mentioned.
{
"userId" : "245981e3",
"data" : {
"workRate" : 51,
"workStages" : [
{ "value" : "APPLES", "times": 2 },
{ "value" : "PEACH", "times": 2 },
{ "value" : "AVOCADO", "times": 2 }
]
}
}
{
"userId" : "7295ew41",
"data" : {
"workRate" : 45,
"workStages" : [
{ "value" : "LEMON", "times": 13 },
{ "value" : "AVOCADO", "times": 42 },
{ "value" : "KIWI", "times": 14 }
]
}
}
I know this sounds difficult, but I believe that there is somebody who will be able to help me out!