All Projects → rhgrant10 → ndjson

rhgrant10 / ndjson

Licence: other
ndjson with the same interface as the builtin json module

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to ndjson

See
Python's dir() for humans. (GitHub mirror)
Stars: ✭ 240 (+306.78%)
Mutual labels:  pypi
PyGLM
Fast OpenGL Mathematics (GLM) for Python
Stars: ✭ 167 (+183.05%)
Mutual labels:  pypi
django-freeze
🧊 convert your dynamic django site to a static one with one line of code.
Stars: ✭ 81 (+37.29%)
Mutual labels:  pypi
Cn2an
📦 快速转化「中文数字」和「阿拉伯数字」~ (最新特性:分数,日期、温度等转化)
Stars: ✭ 249 (+322.03%)
Mutual labels:  pypi
gagar
Standalone graphical agar.io Python client/bot using GTK and agarnet
Stars: ✭ 21 (-64.41%)
Mutual labels:  pypi
mkdocs-rss-plugin
MkDocs plugin to generate a RSS feeds for created and updated pages, using git log and YAML frontmatter (page.meta).
Stars: ✭ 43 (-27.12%)
Mutual labels:  pypi
Rules python
Experimental Bazel Python Rules
Stars: ✭ 233 (+294.92%)
Mutual labels:  pypi
hera-workflows
Hera is an Argo Workflows Python SDK. Hera aims to make workflow construction and submission easy and accessible to everyone! Hera abstracts away workflow setup details while still maintaining a consistent vocabulary with Argo Workflows.
Stars: ✭ 252 (+327.12%)
Mutual labels:  pypi
awesome-json-next
A Collection of What's Next for Awesome JSON (JavaScript Object Notation) for Structured (Meta) Data in Text - JSON5, HJSON, HanSON, TJSON, SON, CSON, USON, JSONX/JSON11 & Many More
Stars: ✭ 50 (-15.25%)
Mutual labels:  ndjson
distfit
distfit is a python library for probability density fitting.
Stars: ✭ 250 (+323.73%)
Mutual labels:  pypi
MyJWT
A cli for cracking, testing vulnerabilities on Json Web Token(JWT)
Stars: ✭ 92 (+55.93%)
Mutual labels:  pypi
py-mon
Simple package to automatically restart application when file changes are detected!
Stars: ✭ 33 (-44.07%)
Mutual labels:  pypi
Demo.Ndjson.AsyncStreams
Sample project for demonstrating how to use async streams and NDJSON to improve user experience by streaming JSON objects from server to client and client to server in .NET
Stars: ✭ 30 (-49.15%)
Mutual labels:  ndjson
Nbdev
Create delightful python projects using Jupyter Notebooks
Stars: ✭ 3,061 (+5088.14%)
Mutual labels:  pypi
pmm
PyPi Mirror Manager
Stars: ✭ 29 (-50.85%)
Mutual labels:  pypi
Mitype
Typing speed test in terminal
Stars: ✭ 241 (+308.47%)
Mutual labels:  pypi
Random-Plex-Movie
Python App which chooses a random movie from your Plex Library.
Stars: ✭ 17 (-71.19%)
Mutual labels:  pypi
craft
The universal Sentry release CLI 🚀
Stars: ✭ 117 (+98.31%)
Mutual labels:  pypi
pyfma
Fused multiply-add (with a single rounding) for Python.
Stars: ✭ 18 (-69.49%)
Mutual labels:  pypi
vfxwindow
Python Qt Window class for compatibility between VFX programs
Stars: ✭ 80 (+35.59%)
Mutual labels:  pypi

ndjson

Support for ndjson. Plain and simple.

https://img.shields.io/pypi/pyversions/ndjson https://img.shields.io/pypi/l/ndjson

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].