Skip to main content

JSON Helpers

Project description

CircleCI Coverage


The jsonio package provides utility functions for reading and writing JSON data. It supports the following features:


pip install jsonio

Easy Read/Write


import jsonio

data ='/foo/bar.json')


import jsonio

jsonio.write({'foo': 'bar'}, '/foo/bar.json')

Works Just Like The json Library


import jsonio

with open('/foo/bar.json', 'r') as jsonfile:
    data = jsonio.load(jsonfile)


import jsonio

data = jsonio.loads('{"foo": "bar"}')


import jsonio

with open('/foo/bar.json', 'w') as jsonfile:
    jsonio.dump({'foo': 'bar'}, jsonfile)


import jsonio

data = {
    'apple': 'crumble',
    'banana': 'split',

# Use standard options.
text = jsonio.dumps(data, jsonfile, indent=2, sort_keys=True)

Supports date/datetime Objects

import datetime
import jsonio

before = {

data = jsonio.dumps(before)
after = jsonio.loads(data)
assert before == after  # True

Supports dataclasses (Python 3.7+)

from dataclasses import dataclass
import jsonio

class Fruit:
    apple: str
    banana: str

before = Fruit(apple='Fuji', banana='Lady Finger')

data = jsonio.dumps(before)
after = jsonio.loads(data)
assert before == after  # True

Preserve Ordering - i.e. OrderedDict Objects

import collections
import jsonio

before = collections.OrderedDict([('banana', 'split'), ('apple', 'crumble')])

text = jsonio.dumps(before, indent=2)
after = jsonio.loads(text, ordered=True)
assert before == after  # True

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

jsonio-0.1.4.tar.gz (5.1 kB view hashes)

Uploaded source

Built Distribution

jsonio-0.1.4-py2.py3-none-any.whl (6.1 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page