json-to-files by simonw

2 downloads this week        Star

README source code


PyPI Changelog Tests License

Create separate files on disk based on a JSON object


Install this tool using pip:

pip install json-to-files


This tool takes a JSON file that looks like this:

    "foo.txt": "The contents of foo.txt",
    "bar/baz.txt": "The contents of baz.txt"

And uses it to write out the following files on disk:

  • foo.txt containing "The contents of foo.txt"
  • bar/baz.txt containing "The contents of baz.txt"

You can run it like this:

json-to-files bundle.json

Or you can specify a directory to write those files to:

json-to-files bundle.json -d /tmp/other-directory

The bundles.json file name is optional - if omitted, this tool will read from standard input:

cat bundle.json | json-to-files


To contribute to this tool, first checkout the code. Then create a new virtual environment:

cd json-to-files
python -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests: