JSON encode arbitrary objects as string representationa
This commit is contained in:
parent
49edf16883
commit
98d8993beb
1 changed files with 5 additions and 1 deletions
|
|
@ -35,7 +35,11 @@ class JSONEncoder(json.JSONEncoder):
|
||||||
else:
|
else:
|
||||||
# call base class implementation which takes care of
|
# call base class implementation which takes care of
|
||||||
# raising exceptions for unsupported types
|
# raising exceptions for unsupported types
|
||||||
return json.JSONEncoder.default(self, o)
|
try:
|
||||||
|
return json.JSONEncoder.default(self, o)
|
||||||
|
# if it's some mystery object, just return a string representation
|
||||||
|
except TypeError:
|
||||||
|
return str(o)
|
||||||
|
|
||||||
|
|
||||||
# MAIN CONFIG CLASS
|
# MAIN CONFIG CLASS
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue