equal
deleted
inserted
replaced
206 elif util.safehasattr(obj, '__iter__'): |
206 elif util.safehasattr(obj, '__iter__'): |
207 out = [] |
207 out = [] |
208 for i in obj: |
208 for i in obj: |
209 out.append(json(i)) |
209 out.append(json(i)) |
210 return '[' + ', '.join(out) + ']' |
210 return '[' + ', '.join(out) + ']' |
|
211 elif util.safehasattr(obj, '__call__'): |
|
212 return json(obj()) |
211 else: |
213 else: |
212 raise TypeError('cannot encode type %s' % obj.__class__.__name__) |
214 raise TypeError('cannot encode type %s' % obj.__class__.__name__) |
213 |
215 |
214 def _uescape(c): |
216 def _uescape(c): |
215 if ord(c) < 0x80: |
217 if ord(c) < 0x80: |