aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaZderMind2015-04-05 19:38:32 +0200
committerMaZderMind2015-04-05 19:38:32 +0200
commitac263c7672d78151ffdf2990dd98127cee572717 (patch)
treed67dcee26eadb7ef9f223da64de6cd35dbbae3c2
parent7b70c44859455d6c19e3e5105e871c8ba824ffe8 (diff)
Objects are unsorted in JSON, revose API tu use Arrays instead
-rw-r--r--view/streams-json-v1.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/view/streams-json-v1.php b/view/streams-json-v1.php
index 0988269..0f73be9 100644
--- a/view/streams-json-v1.php
+++ b/view/streams-json-v1.php
@@ -13,6 +13,7 @@ $overview = new Overview();
$struct = array();
foreach($overview->getGroups() as $group => $rooms)
{
+ $roomstruct = array();
foreach($rooms as $room)
{
$streams = array();
@@ -68,7 +69,8 @@ foreach($overview->getGroups() as $group => $rooms)
break;
}
- $streams[$key] = array(
+ $streams[] = array(
+ 'slug' => $key,
'display' => $stream->getDisplay(),
'type' => $stream->getPlayerType(),
'isTranslated' => $stream->isTranslated(),
@@ -77,11 +79,17 @@ foreach($overview->getGroups() as $group => $rooms)
);
}
- $struct[$group][$room->getSlug()] = array(
+ $roomstruct[] = array(
+ 'slug' => $room->getSlug(),
'display' => $room->getDisplay(),
'streams' => $streams,
);
}
+
+ $struct[] = array(
+ 'group' => $group,
+ 'rooms' => $roomstruct,
+ );
}
echo json_encode($struct, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);