Config: Fix issue with JSON output

This commit is contained in:
Ali Saidi 2012-01-09 20:04:28 -05:00
parent e826d23a2e
commit e308208f30

View file

@ -905,7 +905,15 @@ class SimObject(object):
for param in sorted(self._params.keys()):
value = self._values.get(param)
try:
d[param] = self._values[param].value
# Use native type for those supported by JSON and
# strings for everything else. skipkeys=True seems
# to not work as well as one would hope
if type(self._values[param].value) in \
[str, unicode, int, long, float, bool, None]:
d[param] = self._values[param].value
else:
d[param] = str(self._values[param])
except AttributeError:
pass