Skip to main content

A JSON streaming writer

Project description

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)


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jsonstreams-0.3.2.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

jsonstreams-0.3.2-py2.py3-none-any.whl (10.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file jsonstreams-0.3.2.tar.gz.

File metadata

  • Download URL: jsonstreams-0.3.2.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for jsonstreams-0.3.2.tar.gz
Algorithm Hash digest
SHA256 7d7802cc23509d1d129d640e591651f979defc74da69cb8577c6dbcf26b5a5e5
MD5 cb516b89a1bebb0ba212f4d935b958ae
BLAKE2b-256 2857d70adaa037212b48cb06c58055fafae94e482fed50f7ba5addc053ee9588

See more details on using hashes here.

File details

Details for the file jsonstreams-0.3.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for jsonstreams-0.3.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a4bd0ac17993eed8f32ab65d06cc1b9d8f9f92f92c11b4bb9fefb04931dbf791
MD5 b1baa62a30f75ce5c549e5ad6318c2ca
BLAKE2b-256 9a567f2fc8c1a55f2dca89f954c56602a636b352cd903b09a515f9713278d1ca

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page