Skip to main content

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

  1. Clone the repository (if applicable):

    git clone https://github.com/your-username/jsontoggle.git
    cd jsontoggle
    
  2. Create a virtual environment:

    python -m venv .venv
    source .venv/bin/activate # On Windows: .venv\Scripts\activate
    
  3. Install dependencies: Using uv (recommended):

    uv sync
    

    Or 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 t to 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 t will restore it to the JSON file using the saved value from toggles/.

Quitting the TUI

  • Press q to quit the application.

Example Workflow

  1. Start with a demo file:

    jsontoggle start --demo
    
  2. Navigate to featureFlags.darkMode.

  3. Press t to toggle out darkMode. You'll see it disappear from the main JSON structure, and a message indicating it's been toggled out.

  4. The toggles/ directory will now contain a file like featureFlags_darkMode.json with the original value (false).

  5. Quit the application (q).

  6. Re-launch with the demo.json file.

    jsontoggle start demo.json
    

    You'll notice featureFlags.darkMode is still toggled out.

  7. Navigate to the featureFlags.darkMode (Toggled out) node.

  8. Press t again to revert the toggle. The darkMode node will reappear in the JSON, and its toggle file will be removed.

  9. 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)

Source distribution for jsontoggle 0.1.2
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)

Table of built distributions (wheels) for jsontoggle 0.1.2
File Interpreter ABI Platform Actions
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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page