Show More
@@ -189,18 +189,6 b' def json_clean(obj):' | |||
|
189 | 189 | encoded as JSON. Note that this function does not *encode* its inputs, |
|
190 | 190 | it simply sanitizes it so that there will be no encoding errors later. |
|
191 | 191 | |
|
192 | Examples | |
|
193 | -------- | |
|
194 | >>> json_clean(4) | |
|
195 | 4 | |
|
196 | >>> json_clean(list(range(10))) | |
|
197 | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | |
|
198 | >>> sorted(json_clean(dict(x=1, y=2)).items()) | |
|
199 | [('x', 1), ('y', 2)] | |
|
200 | >>> sorted(json_clean(dict(x=1, y=2, z=[1,2,3])).items()) | |
|
201 | [('x', 1), ('y', 2), ('z', [1, 2, 3])] | |
|
202 | >>> json_clean(True) | |
|
203 | True | |
|
204 | 192 | """ |
|
205 | 193 | # types that are 'atomic' and ok in json as-is. |
|
206 | 194 | atomic_ok = (unicode_type, type(None)) |
General Comments 0
You need to be logged in to leave comments.
Login now