Info fra Home Assistant
Utetemperatur: 13.4 °C
New block:
Imported Data:“; echo “- “;
// Example assumes the JSON structure has an array of items under a ‘products’ key
if (isset($data[‘products’]) && is_array($data[‘products’])) {
foreach ($data[‘products’] as $product) {
echo “
- “;
// Access array elements by key
echo “Name: ” . htmlspecialchars($product[‘name’]) . “
“; echo “Price: $” . htmlspecialchars($product[‘price’]); echo “ “;
}
} else {
// If the JSON is a simple array at the top level
foreach ($data as $item) {
echo “ - ” . htmlspecialchars($item[‘name’]) . “ “; } } echo “
Info fra API
Twenty Twenty-Five
email@example.com
+1 555 349 1806