Skip to content

tmartinfr/jgetset

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jgetset

A simple command-line tool for getting and setting first-level keys in JSON dictionary files.

Overview

jgetset provides a straightforward way to read and write top-level key-value pairs in JSON files that contain dictionaries (objects). It's designed for simple configuration files and quick JSON manipulation.

Important: This tool only works with JSON files containing a dictionary at the root level, and only operates on first-level keys. Nested paths are not supported.

Installation

cargo build --release

Usage

Get a value

jgetset <file> <key>

Example:

jgetset config.json username
# Output: "alice"

Set a value

jgetset <file> <key>=<value>

Example:

jgetset config.json username=alice

Values are stored as strings in the JSON file.

Example

Given config.json:

{
  "host": "localhost",
  "port": "8080"
}
# Get a value
$ jgetset config.json host
"localhost"

# Set a value
$ jgetset config.json timeout=30

Result:

{
  "host": "localhost",
  "port": "8080",
  "timeout": "30"
}

Limitations

  • Only works with JSON dictionaries (not arrays or primitives)
  • Only accesses first-level keys (no nested path support like user.name)
  • Values are always stored as strings
  • No support for deleting keys

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages