The spyne.protocol.json package contains the Json-related protocols. Currently, only spyne.protocol.json.JsonDocument is supported.
Initially released in 2.8.0-rc.
This module is EXPERIMENTAL. You may not recognize the code here next time you look at it.
The JSON standard does not define every type that Spyne supports. These include Date/Time types as well as arbitrary-length integers and arbitrary-precision decimals. Integers are parsed to ints or longs seamlessly but Decimals are only parsed correctly when they come off as strings.
While it’s possible to e.g. (de)serialize floats to Decimals by adding hooks to parse_float [1] (and convert later as necessary), such customizations apply to the whole incoming document which pretty much messes up AnyDict serialization and deserialization.
It also wasn’t possible to work with object_pairs_hook as Spyne’s parsing is always “from outside to inside” whereas object_pairs_hook is passed dicts basically in any order “from inside to outside”.
[1] | http://docs.python.org/2/library/json.html#json.loads |
Bases: spyne.protocol.dictdoc.HierDictDocument
An implementation of the json protocol that uses simplejson package when available, json package otherwise.
Parameters: |
|
---|
Bases: spyne.protocol.json.JsonDocument
The JsonP protocol puts the reponse document inside a designated javascript function call. The input protocol is identical to the JsonDocument protocol.
Parameters: | callback_name – The name of the function call that will wrapp all response documents. |
---|
For other arguents, see spyne.protocol.json.JsonDocument.