Skip to content
Snippets Groups Projects
Commit c63c6368 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

fix the module

parent 7d83edff
No related branches found
No related tags found
No related merge requests found
MiniJSON
========
[![Documentation Status](https://readthedocs.org/projects/minijson/badge/?version=latest)](http://minijson.readthedocs.io/en/latest/?badge=latest)
MiniJSON is a codec for a compact binary representation of a subset of JSON.
Usage
-----
......
......@@ -24,3 +24,39 @@ And the following exceptions:
.. autoclass:: minijson.EncodingError
.. autoclass:: minijson.DecodingError
Controlling float output
------------------------
By default, floats are output as IEEE 754 single. To switch to double just call:
.. autofunction:: minijson.switch_default_double
or to go again into singles:
.. autofunction:: minijson.switch_default_float
Serializing objects
-------------------
If you got an object, whose entire contents can be extracted from it's :code:`__dict__`,
and which can be instantiated with a constructor providing this :code:`__dict__` as keyword
arguments to the program, you can use functions below to serialize/unserialize them:
.. autofunction:: minijson.dumps_object
.. autofunction:: minijson.loads_object
Example:
.. code-block:: python
from minijson import loads_object, dumps_object
class Test:
def __init__(self, a):
self.a = a
a = Test(3)
b = dumps_object(a)
loads_object(b, Test)
from .routines import dumps, loads, switch_default_double, switch_default_float, \
dumps_object, loads_object
dumps_object, loads_object, parse, dump
from .exceptions import MiniJSONError, EncodingError, DecodingError
__all__ = ['dumps', 'loads', 'switch_default_float', 'switch_default_double',
'dumps_object', 'loads_object', 'parse', 'dump']
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment