Skip to main content

A CLI tool to edit simple JSON and YAML data files

Project description

sde

PyPI version

sde is not sed. It's a structured data editor for CLI.

Why?

Many people asked for a simple JSON in-place editing and jq was the solution:

jq '.address = "abcde"' test.json|sponge test.json

Does this seem readable or elegant to you?

sde is not a substitue for jq or sed.

It allows simple in-place JSON value changes, for simple data.

{
   "name":"John",
   "age":31,
   "city":"New York",
   "extra": {
       "sex": "male"
   }
}

Modify data

sde name Jack data.json
sde extra.sex female data.json

It is possible to modify data in arrays, e.g.:

{
    "pools": [
        {
            "tls": false, 
            "rig-id": null, 
            "nicehash": false, 
            "url": "pool.hashvault.pro:80", 
            "user": "YOUR_WALLET_ADDRESS", 
            "pass": "x", 
            "enabled": true, 
            "daemon": false, 
            "algo": null, 
            "tls-fingerprint": null, 
            "keepalive": false
        }
    ],
}

Update first pool's pass value to value secret:

sde pools.0.pass secret data.json

Installation for CentOS/RHEL 7, 8 or Amazon Linux 2

sudo yum -y install https://extras.getpagespeed.com/release-latest.rpm
sudo yum -y install sde

Installation for other systems

Installing with pip is easiest:

pip install sde

TODO

Work with stdin

echo $json | sde name Jack

Query simple data

sdg name data.json

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

sde-0.0.3.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

sde-0.0.3-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file sde-0.0.3.tar.gz.

File metadata

  • Download URL: sde-0.0.3.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for sde-0.0.3.tar.gz
Algorithm Hash digest
SHA256 ab75a6d78b5320cd6d1024fa30e44f2f8cc706a5467ea856be2e07ebdb5621ec
MD5 5596f1c4dcbc5984886777ade73fe685
BLAKE2b-256 83dfaba28dfa26efa0b94b3263be28486f0ab387840205005582cde599b87386

See more details on using hashes here.

File details

Details for the file sde-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: sde-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for sde-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8a3ebb5eededd05ba056af218b70cbb404eab49ebd7454f7fe2e815f50185741
MD5 78668a96265b18412f6b39758b78b07d
BLAKE2b-256 0598b9b53fb0db95216920714c5c90c6ced255e49889445c23cf22047e313ed9

See more details on using hashes here.

Supported by

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