Giter VIP home page Giter VIP logo

json-tui's Introduction

json-tui

Video

Features

  • Interactive: Use keyboard or mouse to scroll/expand objects.

  • Colors

  • Responsive: Adapt to the terminal dimensions. Very long text values are wrapped on several lines.

  • Cross-platform: Windows, Linux, MacOS.

  • Small: ~0.7MB all included. Zero dependencies.

  • The output is displayed inline with the previous commands. Meaning you can still see the json after leaving json-tui.

  • (Vim users): Also support j/k for navigation.

  • Table view: Turn arrays of objects into tables.

    Video

    ezgif com-gif-maker (7)

Features for developers

  • simple: Only ~400 line of C++ only. Depends on FTXUI.
  • No dependencies to install. Build simply using CMake.

Build:

mkdir build; cd build
cmake ..
make
sudo make install

Package

sudo snap install json-tui

Contributors:

Contributor Work
Arthur Sonzogni Author & Maintainer
Igor Rudenko Refactoring. Fix buffer size when reading from a file.
Corentin Girard Arch linux package.
Adrià Arrufat Fix CMake build caused by GIT_SHALLOW TRUE
You? (PR are welcomed)

Similar projects:

json-tui's People

Contributors

arrufat avatar arthursonzogni avatar drarig29 avatar hextriclosan avatar ousttrue avatar tchaikov 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  avatar

json-tui's Issues

Integer overflow for big numbers in JSON

I was working with Unix timestamps, and the displayed number is incorrect. It looks like an integer overflow.

{
  "big": 1640267163452
}

What is displayed:

{
  "big": -410343620
}

Add possibility to unroll and collapse all structured data in selected column at once in table view

If we're in table view and if we have json input that contains structured data (arrays, objects...) in certain columns, then by default, the arrays are collapsed and one needs to press "Mouse::Left" or "enter" for each such value in the column to have them all unrolled. It would be very practical to have a single keybinding that would unroll all such values in currently selected column at once (and vice-versa - to collapse them all at once).

Cannot build with -fno-exceptions

$ cmake -DCMAKE_CXX_FLAGS="-fno-exceptions" .
$ make :

[ 97%] Building CXX object CMakeFiles/json-tui.dir/src/main.cpp.o
/Users/igor/dev/json-tui/src/main.cpp:324:3: error: cannot use 'try' with exceptions disabled
  try {
  ^
1 error generated.
make[2]: *** [CMakeFiles/json-tui.dir/src/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/json-tui.dir/all] Error 2
make: *** [all] Error 2

Resize to full terminal screen

Thanks for such a great tool! I've been trying to give some feedback.


Like how fx already does, we can resize the output to full terminal screen by passing a flag or by default.

Current behavior:
Screen Shot 2022-01-11 at 12 00 30

Press q to exit. Wdyt?

Can't build version 1.2.0 nor master

Steps to reproduce:

git clone https://github.com/ArthurSonzogni/json-tui
cd json-tui
cmake -B build

output:

-- Populating ftxui
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/json-tui/build/_deps/ftxui-subbuild
[ 12%] Creating directories for 'ftxui-populate'
[ 25%] Performing download step (git clone) for 'ftxui-populate'
Cloning into 'ftxui-src'...
remote: Enumerating objects: 1518, done.        
remote: Counting objects: 100% (1518/1518), done.        
remote: Compressing objects: 100% (700/700), done.        
remote: Total 1518 (delta 804), reused 1298 (delta 718), pack-reused 0        
Receiving objects: 100% (1518/1518), 8.03 MiB | 7.47 MiB/s, done.
Resolving deltas: 100% (804/804), done.
fatal: reference is not a tree: 3dc215e6c0eecb1607d428af0295bcd98db74b8f
CMake Error at ftxui-subbuild/ftxui-populate-prefix/tmp/ftxui-populate-gitclone.cmake:40 (message):
  Failed to checkout tag: '3dc215e6c0eecb1607d428af0295bcd98db74b8f'


make[2]: *** [CMakeFiles/ftxui-populate.dir/build.make:98: ftxui-populate-prefix/src/ftxui-populate-stamp/ftxui-populate-download] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/ftxui-populate.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
CMake Error at /usr/share/cmake/Modules/FetchContent.cmake:1087 (message):
  Build step for ftxui failed: 2
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FetchContent.cmake:1216:EVAL:2 (__FetchContent_directPopulate)
  /usr/share/cmake/Modules/FetchContent.cmake:1216 (cmake_language)
  CMakeLists.txt:33 (FetchContent_Populate)


-- Configuring incomplete, errors occurred!

Version 1.1.0 builds fine, though.

Thanks in advance :)

Output not scrolling if oversized

I'm trying this tool - it looks really great and useful. I'm just running into what might be a possible bug. After expanding the output to "table view" and whenever that output doesn't fit current cmd line window, the output does not scroll when I get to the last line at the very bottom of the window and then I want to move further down (the highlight for cursor is lost and there's no scrolling happening). Is there any key shortcut to manually scroll the output or is this just a bug? Thanks.

Bug - does not line wrap very long components inside a nested block

I have tested this on latest bleeding edge version (pulled the source and compiled myself), and it, unfortunately, fails to display them correctly.

JSON file

test.json:

{
    "add_fraction": {
        "410316161936543210318350169581764580736439706176897187461658745638794056381701649193496832507908441/110671625084041270369510745874519827349056231468761863406526354819216040200965715245470578016585408 780107824732963918497386127905416971547624143459884572049407936047104618365218009083504802769369177/682940054189039580356617302601487398249912223437990021245684561942032321432853067545223611875328379": 2.485323
    }
}

Command

json-tui test.json

Without the nested { ... } as a value to the add_fraction key, it works as expected:
image

However, adding one makes the line wrapping functionality break,
image

Keybindings

Hey there, found the tool just yet and it looks pretty nice. Would like to use it :)

I've some questions regarding keybindings?

  • Are they documented somewhere? If not, it would be cool to have them in a complete table view in the README and either showing up with --help or inside the tool (? or h). Just ideas.
  • Functionality: I can list what I tried (and at the same time it would be cool if some of these were added)
    • Arrow left (or h) to close
    • Arrow right (or l) to open
    • Jump to bottom (e.g. G like Vim)
    • Jump to top (e.g. gg like Vim)
    • Copy (e.g. yy like Vim) #10

I know this ticket is too broad. Depending on the answer it could either be refined or split up into several issues.

Hitbox issue when not on top of the terminal window

Sorry if I'm being annoying, but I found a hitbox bug. The video explains it all.

Basically, after I hit Ctrl+C and re-run the command, the hitboxes are shifted away from their real location.

I really think it's because the command isn't run from the top of the window.

Could someone test this in his terminal? Maybe the bug comes from my terminal emulator actually... I use https://github.com/kovidgoyal/kitty

Here is the example file I used: https://pastebin.com/HxCY0NUm

2022-01-10.21-48-00.mp4

Question about `args` library

Could say why does it want to link to args when that is supposed to be a header-only library, and it does not install anything one can link to?

Also, just removing that line seems to work fine, and json-tui builds normally and appears to work.

P. S. We would like to build it against externally installed libraries, without using any bundled third-party stuff.

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.