Closed dagwieers closed 6 years ago
@dagwieers - the returned object is a Python object. Serializing into JSON returns a valid JSON object. For example:
>>> json.dumps(xmljson.badgerfish.data(fromstring('<root x="nan"/>')))
'{"root": {"@x": NaN}}'
>>> json.dumps(xmljson.badgerfish.data(fromstring('<root x=""/>')))
'{"root": {"@x": null}}'
The results are valid JSON. I don't think this PR is required... unless I'm missing something?
@sanand0 NaN and infinity are not accepted by the JSON standard, but apparently the python json library setsallow_nan=True
. See: https://stackoverflow.com/questions/6601812/sending-nan-in-json
But apart from trying to fix that, this PR fixes a few other things, like empty strings should not be converted to null IMO.
This PR fixes a few issues:
This fixes #23
PS Do we have a location for adding unit-tests so we can test whether XMLData works as designed ?