diff --git a/library/Icingadb/Data/JsonResultSetUtils.php b/library/Icingadb/Data/JsonResultSetUtils.php index 39a0a3fe..96883f9e 100644 --- a/library/Icingadb/Data/JsonResultSetUtils.php +++ b/library/Icingadb/Data/JsonResultSetUtils.php @@ -85,13 +85,16 @@ trait JsonResultSetUtils $offset = 0; } + $first = true; echo '['; do { $query->offset($offset); $result = $query->execute()->disableCache(); - foreach ($result as $i => $object) { - if ($i > 0 || $offset !== 0) { + foreach ($result as $object) { + if ($first) { + $first = false; + } else { echo ",\n"; }