Added proper character escaping during JSON serialization.