/gson-viewer

Interactive command-line JSON viewer.

Primary LanguageGoMIT LicenseMIT

gson-viewer License: MIT Go Report Card Join the chat at https://gitter.im/hlts2/gson-viewer

gson-viewer is an interactive command-line JSON viewer.

Install

go get github.com/hlts2/gson-viewer

Demo

An interactive command-line JSON viewer demo.

gson-viewer

Example

File Mode

To launch an interactive command-line JSON viewer from file.

gson-viewer -s {json file}

Pipe Mode

To launch an interactive command-line JSON viewer from pipe.

cat test.json | gson-viewer

REPL Mode

How to get JSON value

The path is syntax such as created_at.date. And if you want to get the element of array, please put a number such as friends.[0].

{
    "friends": [
        {"name": "hlts2"},
        {"name": "hiroto"}
    ],
    "created_at": {
        "date": "2017-05-10 12:54:18",
        "timezone": "UTC"
    }
}
>>> friends.[1].name
// hiroto

show command

The show command shows shaped JSON

>>> show

How to exit

ctl-d