Escape JSON string for XBlock validation messages