Convert chat messages to JSON. Closes #120.