Hi,
I am making heavy use of the fabulous gjson package which is taking a lot of pain away from working with Json in Go.
I’ve run up against an interesting problem though and would appreciate any thoughts or assistance with it.
I have a chunk of json:
{
"took": 31,
"timed_out": false,
"_shards": {
"total": 70,
"successful": 70,
"failed": 0
},
"hits": {
"total": 3709706,
"max_score": 0,
"hits": []
},
"facets": {
"1": {
"_type": "date_histogram",
"entries": [
{
"time": 1502874000000,
"count": 10,
"min": 0.893,
"max": 1.758,
"total": 13.5977,
"total_count": 10,
"mean": 1.35977
}
]
}
}
}
and I am trying to extract the “mean” value of 1.35977. With straight jsonpath, its a walk in the park using:
*.1.entries.*.mean
But I’m not able to use that in gjson. I’ve been using the test playground here:
http://tidwall.com/gjson-play/
Which is hugely helpful… but so far no pattern I’ve tried has helped. Would appreciate any assistance.
Thanks