Added functionality to send JSON messages