<?php
require_once('../../config/Conexion.php');

$sql = "SELECT c.idcaja,c.nombre,i.imagen,c.latitud,c.longitud FROM caja_linea c JOIN icono i ON c.idicono=i.idicono";
$result = $conexion->query($sql);

$cajas = [];
while ($row = $result->fetch_assoc()) {
    $cajas[] = $row;
}

echo json_encode($cajas);
$conexion->close();
?>