I have the following JSON:
[{
"id": 1,
"title": "",
"description": "",
"price": 30.00,
"brand": "",
"images": [{
"sort": 1,
"alt": "product",
"image": "hoodie-man-1.png"
}],
"options": [{
"sizes": "S,M,L,XL,XXL",
"colors": "Black,Purple,Charcoal,Grey"
}],
"tags": "hoodie,mens",
"categories": ["Mens"],
"collection": "boomers",
"ribbon": {
"enabled": true,
"class": "primary",
"text": "New"
},
"enabled": true
},
{
"id": "2",
"title": "",
"description": "",
"price": 30.00,
"brand": "",
"images": [{
"sort": 1,
"alt": "product",
"image": "hoodie-man-2.png"
}],
"options": [{
"sizes": "S,M,L,XL,XXL",
"colors": "Black,Purple,Charcoal,Grey"
}],
"tags": "hoodie,mens",
"categories": ["Mens"],
"collection": "boomers",
"ribbon": {
"enabled": true,
"class": "primary",
"text": "New"
},
"enabled": true
}
Iâm trying to filter this with the following (in a partial):
{{ range where (getJSON "/data/products.json") "id" .params.product_id }}
{{ $product := . }}
{{ end }}
undefined variable â$productâ because there is no match in the data file.
.params.product_id outputs as 1.
Any ideas? Any help is appreciated.