Updated download logic.
Downloads are now mainly handled through through the new v0/IO.php in the API. Http headers for the downloads are configured here and in the UI the headers are actually passed to Slim so that the download is triggered. Part of #918.
Also updated JSONSerializer to handle associative arrays in order to allow the passing of header data.