npm package: @lafferty-lounge/json
Description: A simple json inspector
Author: Craig Lafferty craigplafferty@gmail.com
Latest version: 0.1.3

# @lafferty-lounge/json

The json-ll utility lets you easily inspect, merge, modify, and export JSON and yaml

## Installation

```bash
npm install -g @lafferty-lounge/json
```

## Usage

```bash
json-ll [object path] (--options, ...)
```

## Examples

### Read from stdin

```bash
echo '{"foo": ["bar"]}' | json-ll foo # -> ["bar"]
echo '{"foo": ["bar"]}' | json-ll foo[0] # -> bar
```

### Read from inline

```bash
json-ll foo -f '{"foo": ["bar"]}' # -> ["bar"]
json-ll foo[0] -f '{"foo": ["bar"]}' # -> bar
```

### Read from file

__foo.yaml__

```yaml
foo:
  - bar
```

```bash
json-ll foo -f foo.yaml # -> ["bar"]
json-ll foo[0] -f foo.yaml # -> bar
```

### Merging values

```bash
json-ll -f '{"foo": {"bar": "baz"}}' --fs foo.bar -t '{"bar": "qux"}' --ts bar # -> '{"foo": {"bar": "qux"}}'
```

## Flags

| Arguments       | Shorthand | Input                                   | Default | Description                                                                                                                   |
|-----------------|-----------|-----------------------------------------|---------|-------------------------------------------------------------------------------------------------------------------------------|
| --to            | -t        | - , /filepath, '{ "inline" : "json" }'  | -       | The source of 'to' JSON/yaml when merging. Read from stdin (-), a file (/filepath), or parse the raw --to argument ('{}').    |
| --from          | -f        | -, /filepath, '{ "inline" : "json" }'   | -       | The source of 'from' JSON/yaml when merging. Read from stdin (-), a file (/filepath), or parse the raw --from argument ('{}') |
| --to-selector   | --ts      | object.path.[0].syntax                  |         | The object/property path to set in the 'to' JSON                                                                              |
| --from-selector | --fs      | object.path[0].syntax                   |         | The object/property path to take from the 'from' JSON                                                                         |
| --value         | -v        | -, '{ "inline" : "json" }'              |         | The value to use in place of the 'from' JSON content.                                                                         |
| --selector      | -s        | object.path.[0].syntax                  |         | The object path to use when no merging is taking place.                                                                       |
| --output-file   | --of      | /filepath                               |         | The file to write the output of the command to if specified. Content is printed to stdout by default.                         |
| --keys          | -k        |                                         | false   | List only the keys for an object path                                                                                         |
| --newline       | -n        |                                         | false   | When set the newline that normally appears at the end of the output is ignored. (Don't write newline)                         |
| --spaces        |           | [-1,0,1,2,...]                          | 3       | When outputting in the JSON format the --spaces flag tells how many spaces to use for indentation. -1 for no indentation.     |
| --output        | -o        | raw, pretty, json, yaml                 | pretty  | What format to output the data in                                                                                             |

## Quirks
  * You can't escape `.` yet so you can't use keys with literal dots.