ndjson
Support for ndjson. Plain and simple.
Features
familiar interface
very small
no dependencies
works as advertised
has tests
Usage
ndjson exposes the same api as the builtin json and pickle packages.
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)
The library also packs reader and writer classes very similar to standard csv ones:
import ndjson
# Streaming lines from ndjson file:
with open('./posts.ndjson') as f:
reader = ndjson.reader(f)
for post in reader:
print(post)
# Writing items to a ndjson file
with open('./posts.ndjson', 'w') as f:
writer = ndjson.writer(f, ensure_ascii=False)
for post in posts:
writer.writerow(post)
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
0.3.1 (2020-02-24)
Fix a small spelling mistake
0.3.0 (2020-02-24)
Add ndjson.writer
Add ndjson.reader
0.2.0 (2019-08-01)
Add 3.7 support
Remove 3.4 support
0.1.0 (2018-05-17)
First release on PyPI.
Metadata
Release files for ndjson 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ndjson-0.3.1.tar.gz | 6.4 kB | Without provenance | Details for ndjson-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ndjson-0.3.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for ndjson-0.3.1-py2.py3-none-any.whl |
Total release size: 11.8 kB
Release files / ndjson-0.3.1.tar.gz
| Download URL | ndjson-0.3.1.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bf9746cb6bb1cb53d172cda7f154c07c786d665ff28341e4e689b796b229e5d6
|
|
BLAKE2b-256 checksum How to use checksums |
b4d5209b6ca94566f9c94c0ec41cee1681c0a3b92a306a84a9b0fcd662088dc3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.10.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.4
|
Release files / ndjson-0.3.1-py2.py3-none-any.whl
| Download URL | ndjson-0.3.1-py2.py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
839c22275e6baa3040077b83c005ac24199b94973309a8a1809be962c753a410
|
|
BLAKE2b-256 checksum How to use checksums |
70c904ba0056011ba96a58163ebfd666d8385300bd12da1afe661a5a147758d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.10.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.4
|
Security for ndjson 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.