diff --git a/serializing.html b/serializing.html index b5ba159..2dd3fe6 100644 --- a/serializing.html +++ b/serializing.html @@ -505,7 +505,7 @@ def to_json(python_object):
bytes object: convert the time.struct_time object to a dictionary that only contains JSON-serializable values. In this case, the easiest way to convert a datetime into a JSON-serializable value is to convert it to a string with the time.asctime() function. The time.asctime() function will convert that nasty-looking time.struct_time into the string 'Fri Mar 27 22:20:42 2009'.
-+
With these two custom conversions, the entire entry data structure should serialize to JSON without any further problems.
>>> shell
@@ -513,11 +513,6 @@ def to_json(python_object):
>>> with open('entry.json', 'w', encoding='utf-8') as f:
... json.dump(entry, default=customserializer.to_json)
...
-FIXME
you@localhost:~/diveintopython3/examples$ ls -l example.json @@ -528,9 +523,8 @@ def to_json(python_object): "tags": ["diveintopython", "docbook", "html"], "title": "Dive into history, 2009 edition", "article_link": "http://diveintomark.org/archives/2009/03/27/dive-into-history-2009-edition", "published": true}-
FIXME