From ac263c7672d78151ffdf2990dd98127cee572717 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sun, 5 Apr 2015 19:38:32 +0200 Subject: Objects are unsorted in JSON, revose API tu use Arrays instead --- view/streams-json-v1.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'view') 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); -- cgit v1.2.3