changed stream to send JSON object