Fix error in json deserialize demo

should return obj after setting all attrbutes.
This commit is contained in:
finfou
2016-02-07 19:37:52 +08:00
parent 2a8c3604aa
commit c242aa302a

View File

@@ -209,7 +209,7 @@ JSON编码的格式对于Python语法而已几乎是完全一样的除了一
obj = cls.__new__(cls) # Make instance without calling __init__ obj = cls.__new__(cls) # Make instance without calling __init__
for key, value in d.items(): for key, value in d.items():
setattr(obj, key, value) setattr(obj, key, value)
return obj return obj
else: else:
return d return d