Metadata-Version: 2.0
Name: jsonstreams
Version: 0.3.2
Summary: A JSON streaming writer
Home-page: https://github.com/dcbaker/jsonstreams
Author: Dylan Baker
Author-email: dylan@pnwbakers.com
License: MIT
Keywords: JSON stream
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Intended Audience :: Developers
Requires-Dist: six
Provides-Extra: recomended
Requires-Dist: simplejson; extra == 'recomended'
Provides-Extra: test
Requires-Dist: tox; extra == 'test'

JSONStreams
===========


.. image:: https://travis-ci.org/dcbaker/jsonstreams.svg?branch=master
    :target: https://travis-ci.org/dcbaker/jsonstreams

.. image:: https://ci.appveyor.com/api/projects/status/ocrt9nol8kn3pm1t/branch/master?svg=true
    :target: https://ci.appveyor.com/project/dcbaker/jsonstreams


Source code is available at `github <https://github.com/dcbaker/jsonstreams>`_.

Documentation is available at `readthedocs <https://jsonstreams.readthedocs.io/>`_.

The code is licensed MIT. See the included LICENSE file for the exact terms.


Description
###########

.. include:: docs/source/description.rst


Basic Usage
###########

A simple use looks like this

.. code-block:: python

    with jsonstreams.Stream('foo', 'object') as s:
        s.write('foo', 'bar')
        with s.subobject('a') as a:
            a.write(1, 'foo')
            a.write(2, 'bar')
        s.write('bar', 'foo')

Writing into a closed group will raise an exception, which should not be
handled, this exception is always an error in programming and should be
corrected.

It is possible to write any value that the encoder (json.JSONEncoder by
default) can encode, so iterating over lists or dictionaries to write them in
is unnecessary

.. code-block:: python

    mylist = list(range(10))
    mydict = {a, b, for a in range(10), for b in 'abcdefghij'}

    with jsonstreams.Stream('foo', 'object') as s:
        s.write('list', mylist)
        s.write('dict', mydict)


