- if isinstance(record[key], (list, tuple)):
- record[key] = '; '.join(record[key])
+ elif isinstance(record[key], (list, tuple)) and all(isinstance(v, basestring) for v in record[key]):
+ record[key] = ', '.join(record[key])
+ else:
+ record[key] = json.dumps(record[key])