Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Use JSON files as if they're python modules

Project Description

Have you ever been kept awake at night, desperately feeling a burning desire to do nothing else but directly import JSON files as if they were python modules [1]? Now you can!

This abomination allows you to write

import some_json_file

and if some_json_file.json can be found, it will be available as if it is a python module.


Slap a json file somewhere on your python path. tester.json:

    "hello": "world",
    "this": {
        "can": {
            "be": "nested"

Now import jsonsempai and your json file!

>>> from jsonsempai import magic
>>> import tester
>>> tester
<module 'tester' from 'tester.json'>
>>> tester.hello

Alternatively, a context manager may be used (100% less magic):

>>> import jsonsempai
>>> with jsonsempai.imports():
...     import tester
>>> tester
<module 'tester' from 'tester.json'>

Python packages are also supported:

$ tree
└── python_package
    ├── file.json
    └── nested_package
        └── second.json
>>> from jsonsempai import magic
>>> from python_package import file
>>> file
<module 'python_package.file' from 'python_package/file.json'>
>>> import python_package.nested_package.second
>>> python_package.nested_package.second
<module 'python_package.nested_package.second' from 'python_package/nested_package/second.json'>


Install from pip:

$ pip install json-sempai

or clone this repo and install from source:

$ python install

To purge this horror from your machine:

$ pip uninstall json-sempai
[1]Disclaimer: Only do this if you hate yourself and the rest of the world.
Release History

Release History

This version
History Node


History Node


History Node


History Node


History Node


Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
json_sempai-0.4.0-py2.py3-none-any.whl (6.2 kB) Copy SHA256 Checksum SHA256 2.7 Wheel Jan 19, 2015
json-sempai-0.4.0.tar.gz (3.9 kB) Copy SHA256 Checksum SHA256 Source Jan 19, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting