Use `aeson` for generating `mode=json` response

This fixes the previous fragile way of synthesizing JSON by manual
string concatenations which sometimes results in invalid JSON
responses. Moreover, the lazy bytestring emitted by `aeson`'s encoder
is directly fed into WAI's response structure w/o the need to go
through `String`.