[Python-ideas] Serialization of CSV vs. JSON

Philip Martin philip.martin2007 at gmail.com
Fri Nov 2 12:19:52 EDT 2018


Is there any reason why date, datetime, and UUID objects automatically
serialize to default strings using the csv module, but json.dumps throws an
error as a default? i.e.

import csv
import json
import io
from datetime import date

stream = io.StringIO()
writer = csv.writer(stream)
writer.writerow([date(2018, 11, 2)])
# versus
json.dumps(date(2018, 11, 2))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20181102/da888054/attachment.html>


More information about the Python-ideas mailing list