Giter VIP home page Giter VIP logo

jsed's Introduction

jsed: A JSON Editor

jsed is a small command-line utility to add, remove, and search for data in a JSON structure.

Not to be confused with any other jsed.

Examples

$ echo {} | jsed add object --path foo --value bar -r
{
  "foo": "bar"
}

$ echo {} | jsed add object --path foo --value bar | jsed add array --path bar.baz --value a --value b --value c -r
{
  "bar": {
    "baz": [
      "a",
      "b",
      "c"
    ]
  },
  "foo": "bar"
}

$ echo {} | jsed add object --path foo --value bar | jsed add array --path bar.baz --value a --value b --value c | jsed get --path bar.baz.1
b

$ echo {} | jsed add object --path service \
                            --key name --value redis_master \
                            --key address --value 127.0.0.1 \
                            --key port --value 8000 \
                            --key enableTagOverride --value false \
                            --key checks --value []  \
          | jsed add array --path service.tags --value master --value redis --value mysql \
          | jsed add object --path service.checks --key script --value /usr/local/bin/check_redis.py --key interval --value 10s \
          | jsed add object --path service.checks --key script --value /usr/local/bin/check_mysql.py --key interval --value 10s -r > service.json

$ cat service.json
{
  "service": {
    "address": "127.0.0.1",
    "checks": [
      {
        "interval": "10s",
        "script": "/usr/local/bin/check_redis.py"
      },
      {
        "interval": "10s",
        "script": "/usr/local/bin/check_mysql.py"
      }
    ],
    "enableTagOverride": false,
    "name": "redis_master",
    "port": 8000,
    "tags": [
      "master",
      "redis",
      "mysql"
    ]
  }
}

$ jsed get --file service.json --path service..checks..*..script=/usr/local/bin/check_redis.py --delimiter ..
/usr/local/bin/check_redis.py

$ jsed get --file service.json --path service.checks.* -r
[
  {
    "interval": "10s",
    "script": "/usr/local/bin/check_redis.py
  },
  {
    "interval": "10s",
    "script": "/usr/local/bin/check_mysql.py
  }
]

jsed's People

Contributors

galuszkak avatar jtopjian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

jsed's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.