need to send JSON to client rather than string