Skip to main content

Simply remove JSON keys via CLI command.

Project description

> remove-json-keys

Simply remove JSON keys via CLI command.

Installation

pip install remove-json-keys

Usage

Run the CLI:

remove-json-keys [options] # or remove-json

If no options are passed, the CLI will:

  1. Prompt for keys to delete
  2. Auto-discover closest child json_dir
  3. Delete keys from found JSON files

Note: Key/values can span multiple lines and have any amount of whitespace between symbols.

Options

Options can be set by using command-line arguments:

Option Description Example
-d, --json-dir Name of the folder containing JSON files (default: _locales) --json-dir=data
-k, --keys Comma-separated list of keys to remove --keys=app_DESC,err_NOT_FOUND
--config Use custom config file --config=path/to/file
init, -i, --init Create .remove-json.config.json5 in project root to store default settings
-n, --no-wizard Skip interactive prompts during start-up
-h, --help Show help screen
-v, --version Show version
--docs Open docs URL

Examples

Remove author key from JSON files found in default _locales dir:

remove-json-keys --keys=author  # prompts for more keys to remove

Remove info_SUCCESS key from JSON files found in messages dir:

remove-json-keys -n --keys=err_NOT_FOUND --json-dir=messages  # no prompts

Remove app_DESC + app_VER keys from JSON files found in data dir:

remove-json -n -k app_DESC,app_VER -d data  # no prompts

Config file

Run remove-json init to create .remove-json.config.json5 in your project root to set default options.

Example defaults:

{
  "json_dir": "_locales", // name of the folder containing JSON files
  "keys": "",             // keys to remove (e.g. "app_NAME,author")
  "force": false,         // force overwrite existing config file when using init
  "no_wizard": false      // skip interactive prompts during start-up
}

Note: CLI arguments always override config file.

MIT License

Copyright © 2023–2026 Adam Lui.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Back to top ↑

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

remove_json_keys-1.6.0.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

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

remove_json_keys-1.6.0-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file remove_json_keys-1.6.0.tar.gz.

File metadata

  • Download URL: remove_json_keys-1.6.0.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for remove_json_keys-1.6.0.tar.gz
Algorithm Hash digest
SHA256 2022acc47c67edb3fb1b3922bc2cc5ae3a42c4b9da1eb93203c217e9a97f5dd7
MD5 dd58defcc64aec388268d6dece2ddee6
BLAKE2b-256 287dc2ab9f0ce8b0bbe7eb593225d4a302a40958b01656aa36988821275f32de

See more details on using hashes here.

File details

Details for the file remove_json_keys-1.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for remove_json_keys-1.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 26eb503c5c654101e5f1907980e700bf71d3be6bb1ca97e63b70bd79938c94b0
MD5 b51bfe65ceba44ce5fea281c52591ff7
BLAKE2b-256 18706be49fe3e2725bdd60d24f59cdaa218d98c0982d41fa7df1fea61dfe1755

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