JSON Toggle
A CLI tool for interactively toggling JSON nodes on and off within a JSON file, storing the original values for easy restoration.
Features
- Interactive TUI: Navigate and select JSON nodes using a Text User Interface (TUI).
- Toggle Nodes: Easily remove a JSON node from the main file, storing its original value in a separate toggle file.
- Revert Toggles: Restore a previously toggled-out node by reinserting its original value from the toggle file.
- Persistent Toggles: Toggled nodes' states are maintained across sessions, allowing you to manage feature flags or configurations effectively.
Installation
Prerequisites
- Python 3.8 or higher
uv(optional, for faster dependency management)
Steps
-
Clone the repository (if applicable):
git clone https://github.com/your-username/jsontoggle.git cd jsontoggle
-
Create a virtual environment:
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install dependencies: Using
uv(recommended):uv syncOr using
pip:pip install -e .
Usage
The jsontoggle tool provides a TUI for interacting with your JSON files.
Launching the TUI
You can launch the TUI with an existing JSON file or create a demo file.
With an existing JSON file:
jsontoggle start <path_to_json_file>
Example:
jsontoggle start my_config.json
With a demo JSON file:
This will create a demo.json file in your current directory and launch the TUI with it.
jsontoggle start --demo
Navigating the TUI
- Use arrow keys (Up/Down) to navigate through the JSON tree.
- Press Space or Right Arrow to expand/collapse nodes.
Toggling Nodes
- Select a node you wish to toggle.
- Press
tto toggle the selected node.- If the node is present, it will be removed from the JSON file, and its original value will be saved in the
toggles/directory. - If the node was previously toggled out (and appears as "(Toggled out)"), pressing
twill restore it to the JSON file using the saved value fromtoggles/.
- If the node is present, it will be removed from the JSON file, and its original value will be saved in the
Quitting the TUI
- Press
qto quit the application.
Example Workflow
-
Start with a demo file:
jsontoggle start --demo
-
Navigate to
featureFlags.darkMode. -
Press
tto toggle outdarkMode. You'll see it disappear from the main JSON structure, and a message indicating it's been toggled out. -
The
toggles/directory will now contain a file likefeatureFlags_darkMode.jsonwith the original value (false). -
Quit the application (
q). -
Re-launch with the
demo.jsonfile.jsontoggle start demo.json
You'll notice
featureFlags.darkModeis still toggled out. -
Navigate to the
featureFlags.darkMode (Toggled out)node. -
Press
tagain to revert the toggle. ThedarkModenode will reappear in the JSON, and its toggle file will be removed. -
Quit the application.
Metadata
Release files for jsontoggle 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jsontoggle-0.1.2.tar.gz | 5.0 kB | Without provenance | Details for jsontoggle-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jsontoggle-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for jsontoggle-0.1.2-py3-none-any.whl |
Total release size: 9.4 kB
Release files / jsontoggle-0.1.2.tar.gz
| Download URL | jsontoggle-0.1.2.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
099c3817e6e2ba1ad1464539de784bd56bb26e6be895e2bc6b200a0c48762916
|
|
BLAKE2b-256 checksum How to use checksums |
ef128e5adf52273ab396d2f301fa9ac702af6ade4cfd2b5d578b853d4dfa1cce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.19
|
Release files / jsontoggle-0.1.2-py3-none-any.whl
| Download URL | jsontoggle-0.1.2-py3-none-any.whl |
|---|---|
| Size | 4.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b5fc26ec276e0032d21f765f079e4b68c9b1eaf6dd97357808b013a361a128a3
|
|
BLAKE2b-256 checksum How to use checksums |
d9a3ea4a7b63a3f06f01c71fce12f7e9c24c0edc0020516ff72e88cf206df3a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.19
|
Security for jsontoggle 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.