JSON :
{"blockHistory":[10, 12, 14, 17],
"hashrateHistory":[
{"hr":1,"time":9},
{"hr":2,"time":10},
{"hr":3,"time":11},
{"hr":4,"time":12},
{"hr":5,"time":13},
{"hr":6,"time":14},
{"hr":7,"time":15}
]
I want to get hr for every value from blockHistory where time from hashrateHistory is the biggest time <= blockHistory value.
This is what i have. I don't know how to get the lastHR
[{lastHr: .hashrateHistory[].hr, time: .blockHistory[]}] | sort_by(.time)
result i want:
[
{
"lastHr": 2,
"time": 10
},
{
"lastHr": 4,
"time": 12
},
{
"lastHr": 6,
"time": 14
},
{
"lastHr": 7,
"time": 17
}
]