added JSON parsing of messages