diff options
author | MaZderMind | 2015-04-05 19:38:32 +0200 |
---|---|---|
committer | MaZderMind | 2015-04-05 19:38:32 +0200 |
commit | ac263c7672d78151ffdf2990dd98127cee572717 (patch) | |
tree | d67dcee26eadb7ef9f223da64de6cd35dbbae3c2 /view | |
parent | 7b70c44859455d6c19e3e5105e871c8ba824ffe8 (diff) |
Objects are unsorted in JSON, revose API tu use Arrays instead
Diffstat (limited to '')
-rw-r--r-- | view/streams-json-v1.php | 12 |
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); |