How do I return the index for the array element whose sub-element value is the closest matching Int to my query.
eg: If the array looks like this:
{
"data": [
{
"time": 1483304400,
},
{
"time": 1483308000,
},
{
"time": 1483311600,
},
{
"time": 1483315200,
},
{
"time": 1483318800,
}
]
}
and my query is 1483311700 then I want to return 2 as that's the index for the closest matching element.
demjson.decode(String that containing the input)then look it like an array , use a for loop , then calculate the most close number to your expected number