New submission from Anders Rundgren:

jsonString = '{"t":6,"h":4.50, "g":"text","j":1.40e450}'
jsonObject = json.loads(jsonString, 
object_pairs_hook=collections.OrderedDict,parse_float=Decimal)
for item in jsonObject:
  print jsonObject[item]
6
4.50
text
1.40E+450

Works as expected.

However, there seems to be no way to get back to the original JSON string as 
far as I can tell since you have to convert Decimal to str in cls when using 
json.dumps which adds "" around the arguments

----------
components: Extension Modules
messages: 233139
nosy: anders.rundgren....@gmail.com
priority: normal
severity: normal
status: open
title: Only READ support for Decimal in json
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23123>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to