diff --git a/README.md b/README.md index 7e3e3d90d07dd6f2879f620723ba9dcaf87fa426..d6264c88b8f532cc42ba6d26a7c4b7ffde925f00 100644 --- a/README.md +++ b/README.md @@ -8,68 +8,15 @@ Usage ----- As usual, please [RTFM](minijson/routines.pxd). -Here's the [specification](specification.md) of MiniJSON +Here's the [specification](specification.md) of MiniJSON. -It works pretty the same as pyyaml or json: +Refer to the [documentation](http://minijson.readthedocs.io/en/latest/?badge=latest) +for use. -```python -from minijson import dumps, loads +If there are no binary wheels precompiled for this platform, you will need to compile it yourself. -b_bytes = dumps({'hello': 'world'}) -data = loads(b_bytes) -assert data == {'hello': 'world'} +In order to do that you must have the following packages installed: -import io -from minijson import dump - -cio = io.BytesIO() -dump({'hello': 'world'}, cio) -``` - -By defaults floats are encoded as IEEE 754 singles. To force them to be encoded as doubles, do: - -```python -from minijson import switch_default_float, switch_default_double - -switch_default_double() -# now everything is encoded as a double -switch_default_float() -# and now as float -``` - -Exceptions ----------- - -```python -from minijson import MiniJSONError, EncodingError, DecodingError - -assert issubclass(MiniJSONError, ValueError) -assert issubclass(DecodingError, MiniJSONError) -assert issubclass(EncodingError, MiniJSONError) -``` - -Loading and dumping objects ---------------------------- - -Assume you have an object defined like this: - -```python -class Test: - def __init__(self, a): - self.a = a - - def __eq__(self, o): - """Not necessary""" - return self.a == o.a -``` - -You can use provided methods to serialize and unserialize it: - -```python -from minijson import loads_object, dumps_object - -a = Test(2) -b = dumps_object(a) -c = loads_object(b, Test) -assert a == c -``` +* snakehouse +* satella +* Cython