converted creating and parsing message to JSON