Giter Club home page Giter Club logo

jsonfui's Introduction

jsonfui

jsonfui is an interactive command-line JSON viewer. Examples

Installation

Download Binary

Download latest release from GitHub (does not require node.js).

npm Release

Or, install via npm (requires node.js):

npm install -g jsonfui

Usage

To start jsonfui, pass a filename to it:

jsonfui /path/to/file.json

You can also read from stdin instead of a file:

curl -s https://api.github.com/users/adrianschneider/repos | jsonfui

You can also write to stdout with Enter:

# list repos, pick one, view on github
curl -s https://api.github.com/users/adrianschneider/repos | jsonfui | xargs open

When the application is open, you are in a vim-style tree viewer.

Hotkeys (vim mode)

down, j: down
up, k: up
left, h: go back/up one level
right, l: view child node
<Enter>: send current selection to stdout and exit
y or c: copy current value to clipboard
-: toggle expansion
/: search for string recursively
*: search for value under cursor
n: next search result at current depth
N: prev search result at current depth
<space>: clear highlight

Examples

Reading from Standard In

Piped Content

Reading from a File

Local File

jsonfui's People

Contributors

adrianschneider avatar fgadrian 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  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  avatar  avatar  avatar

jsonfui's Issues

feature request: emacs movement keys

Shouldn't be too hard; these are 1-1 mappings that emacs users would really appreciate and shouldn't conflict with any vi-keys. I'd do it myself but I don't know js ;;

Ctrl-N: down
Ctrl-P: up
Ctrl-B: go back/up one level
Ctrl-F: view child node

very cool... widgetize?

Hey @AdrianSchneider, very cool. nice job. Any chance this can be widget-ized and maybe included in blessed-contrib? (maybe it's already possible, just found your project and haven't actually looked at the code yet)

It would be nice to be able to make it available as a widget that can be bundled with lists, tables, boxes, etc...

Feature request: path to current node

Would be nice to see a line at the bottom of the screen that shows the path taken to get to the current node. For instance, if we are currently looking at the contents of the key baz in this structure:

"foo": {
  "bar": {
    "baz": {
      "qux": 1
    }
  }
}

I want to see this at the bottom:

foo > bar > baz

hot key issues

I use jsonfui in remote (ssh) vscode terminal on macbook pro.

  1. left and right keys don't work while h and l work.
  2. <Enter> behaves like l (not 'send current selection to stdout and exit' like the doc said).
  3. y and c raise an Exception and exit. I believe this is because I'm in a ssh terminal.
Error: spawn xclip ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:478:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

Piping into docker container fails with "the input device is not a TTY"

When running jsonfui in a Docker container and piping the json into it, it fails to start with an error:

λ ~/workspace/jsonfui/ master* docker build --rm .
Sending build context to Docker daemon 6.144 kB
Step 1/4 : FROM mhart/alpine-node:latest
latest: Pulling from mhart/alpine-node
627beaf3eaaf: Pull complete
8967246b7a43: Pull complete
Digest: sha256:03f5cfca0497c84e7b5698e96bd757e388a352ad8ac8d940f88a2575840d04b8
Status: Downloaded newer image for mhart/alpine-node:latest
 ---> 4c526da8fee7
Step 2/4 : ENV JSONFUI_VERSION 1.2.4
 ---> Running in 0b1613ca0a45
 ---> 7312e2c2ce3b
Removing intermediate container 0b1613ca0a45
Step 3/4 : RUN npm install -g jsonfui@$JSONFUI_VERSION
 ---> Running in 50c6e101344b
/usr/bin/jsonfui -> /usr/lib/node_modules/jsonfui/bin/jsonfui
/usr/lib
`-- [email protected]
  +-- [email protected]
  +-- [email protected]
  | `-- [email protected]
  `-- [email protected]

 ---> da139d831523
Removing intermediate container 50c6e101344b
Step 4/4 : ENTRYPOINT jsonfui
 ---> Running in 4a90af982bd3
 ---> 6203047c9a70
Removing intermediate container 4a90af982bd3
Successfully built 6203047c9a70
λ ~/ cat ~/Desktop/test.json | docker run -it -e $TERM 6203047c9a70
the input device is not a TTY

Mounting the json file and passing the path as a parameter works as expected:

λ ~/workspace/jsonfui/ master* docker run -it -v /Users/tommy.brunn/Desktop/test.json:/test.json 6203047c9a70 test.json

My reason for doing this is that I have a lot of colleagues who do not want to install node locally, and will definitely not keep it up to date, so running it in a Docker container would be very convenient for them (although copying wouldn't work).

My Dockerfile:

FROM mhart/alpine-node:latest

ENV JSONFUI_VERSION 1.2.4

RUN npm install -g jsonfui@$JSONFUI_VERSION

ENTRYPOINT ["jsonfui"]

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.