Add JSON escaping to type and message strings