Skip to main content

Convert JSON to directory structure and vice versa

Project description

json2dir

A Python package that converts JSON to directory structure and vice versa.

Installation

pip install json2dir

Usage

Command Line Interface

# Convert JSON to directory structure
json2dir convert --input structure.json --output ./output_dir

# Convert directory structure to JSON
json2dir export --input ./my_directory --output structure.json

Python API

from json2dir import json_to_dir, dir_to_json

# Convert JSON to directory structure
json_to_dir("structure.json", "./output_dir")

# Convert directory structure to JSON
dir_to_json("./my_directory", "structure.json")

Example

Input JSON:

{
    "project": {
        "src": {
            "main.py": null,
            "utils": {
                "helper.py": null
            }
        },
        "tests": {
            "test_main.py": null
        },
        "README.md": null
    }
}

This will create a directory structure:

project/
├── src/
│   ├── main.py
│   └── utils/
│       └── helper.py
├── tests/
│   └── test_main.py
└── README.md

License

MIT License

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

json2dir-0.1.0.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

json2dir-0.1.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file json2dir-0.1.0.tar.gz.

File metadata

  • Download URL: json2dir-0.1.0.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for json2dir-0.1.0.tar.gz
Algorithm Hash digest
SHA256 32b0dd1e3f0b6b8e21d2a2cea9f6d22790f45099112d525710cada39039b3863
MD5 b0fba139ed3e6a49b54e5472a459285e
BLAKE2b-256 d139c57782f8bdae41905af5ba2998f5b64abd5eef5a2f56d50e8ba67e8d18c9

See more details on using hashes here.

File details

Details for the file json2dir-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: json2dir-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for json2dir-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 433254ef6adaed4af952716c68a52adc26ad10033ac32ae8a36710d71efeb22b
MD5 e4072665eed7b4e4c604d500ce479e2d
BLAKE2b-256 ac726ce3dcf0bfeb66cefe3f7df147c38540c47a6c6ff3924bba4243e6cba012

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page