forked from pexip/os-python-anyjson
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPKG-INFO
85 lines (65 loc) · 3.03 KB
/
PKG-INFO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
Metadata-Version: 1.1
Name: anyjson
Version: 0.3.3
Summary: Wraps the best available JSON implementation available in a common interface
Home-page: http://bitbucket.org/runeh/anyjson/
Author: Rune Halvorsen
Author-email: [email protected]
License: BSD
Description: ##############################
anyjson - JSON library wrapper
##############################
Overview
--------
Anyjson loads whichever is the fastest JSON module installed and provides
a uniform API regardless of which JSON implementation is used.
Originally part of carrot (http://github.com/ask/carrot/)
Examples
--------
To serialize a python object to a JSON string, call the `serialize` function:
>>> import anyjson
>>> anyjson.serialize(["test", 1, {"foo": 3.141592}, "bar"])
'["test", 1, {"foo": 3.141592}, "bar"]'
Conversion the other way is done with the `deserialize` call.
>>> anyjson.deserialize("""["test", 1, {"foo": 3.141592}, "bar"]""")
['test', 1, {'foo': 3.1415920000000002}, 'bar']
Regardless of the JSON implementation used, the exceptions will be the same.
This means that trying to serialize something not compatible with JSON
raises a TypeError:
>>> anyjson.serialize([object()])
Traceback (most recent call last):
<snipped traceback>
TypeError: object is not JSON encodable
And deserializing a JSON string with invalid JSON raises a ValueError:
>>> anyjson.deserialize("""['missing square brace!""")
Traceback (most recent call last):
<snipped traceback>
ValueError: cannot parse JSON description
Contact
-------
The module is maintaned by Rune F. Halvorsen <[email protected]>.
The project resides at http://bitbucket.org/runeh/anyjson . Bugs and feature
requests can be submitted there. Patches are also very welcome.
Changelog
---------
See CHANGELOG file
License
-------
see the LICENSE file
Keywords: json
Platform: any
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.4
Classifier: Programming Language :: Python :: 2.5
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.1
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Programming Language :: Python :: Implementation :: Jython