mirror of
https://github.com/kennethreitz/dive-into-python3.git
synced 2026-06-05 15:00:18 +00:00
spacing
This commit is contained in:
+1
-2
@@ -568,8 +568,7 @@ NameError: name 'entry' is not defined</samp>
|
||||
|
||||
<p><code>json.load()</code> doesn’t know anything about any conversion function you may have passed to <code>json.dump()</code>. What you need is the opposite of the <code>to_json()</code> function — a function that will take a custom-converted <abbr>JSON</abbr> object and convert it back to the original Python datatype.
|
||||
|
||||
<pre class=pp><code>
|
||||
# add this to customserializer.py
|
||||
<pre class=pp><code># add this to customserializer.py
|
||||
<a>def from_json(json_object): <span class=u>①</span></a>
|
||||
<a> if '__class__' in json_object: <span class=u>②</span></a>
|
||||
if json_object['__class__'] == 'time.asctime':
|
||||
|
||||
Reference in New Issue
Block a user