Skip to main content

JsonDecoder for ndjson

Project description

ndjson

Support for ndjson. Plain and simple.

https://img.shields.io/pypi/v/ndjson.svg https://img.shields.io/travis/rhgrant10/ndjson.svg
  • Free software: GNU General Public License v3

Features

  • familiar interface
  • very small
  • no dependencies
  • works as advertised
  • has tests

Usage

ndjson exposes the same api as the builtin json and pickle packgages.

import ndjson

# load from file-like objects
with open('data.ndjson') as f:
    data = ndjson.load(f)

# convert to and from objects
text = ndjson.dumps(data)
data = ndjson.loads(text)

# dump to file-like objects
with open('backup.ndjson', 'w') as f:
    ndjson.dump(items, f)

It contains JSONEncoder and JSONDecoder classes for easy use with other libraries, such as requests:

import ndjson
import requests

response = requests.get('https://example.com/api/data')
items = response.json(cls=ndjson.Decoder)

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.1.0 (2018-05-17)

  • First release on PyPI.

Project details


Release history Release notifications

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
ndjson-0.1.0-py2.py3-none-any.whl (4.6 kB) Copy SHA256 hash SHA256 Wheel py2.py3
ndjson-0.1.0.tar.gz (5.7 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page