Switch to JSON-encoded responses

Convert all responses to JSON. Implement JSON-encoded error messages.
Add Output module with helper functions for JSON and error messages.
Rewrite Spec.hs to check JSON responses.

Signed-off-by: Stian Ellingsen    <stian@plaimi.net>
Signed-off-by: Alexander Berntsen <alexander@plaimi.net>
Reviewed-by:   Alexander Berntsen <alexander@plaimi.net>