Open Elvins opened 3 years ago
It seems that isn't possible based on this comment
As I had the same problem, I decided to use a for each
in combination with a @this
My JSON
{
"action": "Products",
"product0001": {
"id": "123456",
"name": "alex"
},
"product00012": {
"id": "123456",
"name": "alex"
},
"product0003": {
"id": "123456",
"name": "alex"
}
}
My solution
result := gjson.Get(string(resp.Body(), "@this")
for _, product := range result.Map() {
id := gjson.Get(product.String(), "id")
name := gjson.Get(product.String(), "name")
}
can it support that finding all matches with wildcard? I found that wildcards only returns the first result.