[Python-ideas] Serialization of CSV vs. JSON

M.-A. Lemburg mal at egenix.com
Fri Nov 2 12:31:33 EDT 2018


Serialization of those data types is not defined in the JSON standard:

https://www.json.org/

so you have to extend the parser/serializers to support them.

On 02.11.2018 17:19, Philip Martin wrote:
> 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))
> 
> 
> 
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
> 

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Experts (#1, Nov 02 2018)
>>> Python Projects, Coaching and Consulting ...  http://www.egenix.com/
>>> Python Database Interfaces ...           http://products.egenix.com/
>>> Plone/Zope Database Interfaces ...           http://zope.egenix.com/
________________________________________________________________________

::: We implement business ideas - efficiently in both time and costs :::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/
                      http://www.malemburg.com/



More information about the Python-ideas mailing list