Giter Site home page Giter Site logo

jiq's Introduction

jiq Mentioned in Awesome jq

It's jid with jq.

You can drill down interactively by using jq filtering queries.

jiq uses jq internally, and it requires you to have jq in your PATH.

If you prefer, there's an experimental, standalone, purely client-side web version of this on https://jq.alhur.es/jiq/.

Demo

screencast.gif

Installation

Either prebuilt binary for your system (and make sure to chmod +x it first) or install/compile with Go:

go install github.com/fiatjaf/jiq/cmd/jiq@latest

If you don't have jq installed, follow instructions at https://stedolan.github.io/jq/download/ and make sure to put it in your PATH.

Usage

Quick start

simple example

Execute the following command:

echo '{"aa":"2AA2","bb":{"aaa":[123,"cccc",[1,2]],"c":321}}'| jiq

Then jiq will be running. Now you can dig JSON data incrementally.

When you enter .bb.aaa[2], you will see the following.

[jq]> .bb.aaa[2]
[
  1,
  2
]

If you press Enter now it will output

[
  1,
  2
]

and exit (if you want all the output in a single line you can either call jiq -c or pipe it into jq as jiq | jq -c .).

advanced usage examples

If you have ever used jq, you'll be familiar with these:

echo '{"economists": [{"id": 1, "name": "menger"}, {"id": 2, "name": "mises"}, {"name": "hayek", "id": 3}]}' | jiq

Now try writing .economists | "\(.[0].name), \(.[1].name) and \(.[2].name) are economists." or [.economists.[].id], or even .economists | map({key: "\(.id)", value: .name}) | from_entries

with curl

Sample for using RDAP data.

curl -s http://rdg.afilias.info/rdap/domain/example.info | jiq

command line arguments

-q : print the jq filter instead of the resulting filtered JSON to stdout (if you plan to use this with jq later)

Plus all the arguments jq accepts -- they will affect both the JSON output inside jiq and the output that is printed to stdout (beware that some may cause bugs).


traffic analytics for this repo:

Keymaps

key description
TAB / CTRL + I Show available items and choice them
CTRL + W Delete from the cursor to the start of the word
CTRL + U Delete whole query
CTRL + F / Right Arrow (:arrow_right:) Move cursor a character to the right
ALT + F Move one word forward
CTRL + B / Left Arrow (:arrow_left:) Move cursor a character to the left
ALT + B Move one word backward
CTRL + A / Home To the first character of the 'Filter'
CTRL + E/ End To the end of the 'Filter'
CTRL + J / Down Arrow (:arrow_down:) Scroll json buffer 1 line downwards
CTRL + K / Up Arrow (:arrow_up:) Scroll json buffer 1 line upwards
CTRL + G Scroll json buffer to bottom
CTRL + T Scroll json buffer to top
CTRL + N / PageDown Scroll json buffer 'Page Down'
CTRL + P / PageUp Scroll json buffer 'Page Up'
ESC Hide a candidate box

jiq's People

Contributors

bhenderson avatar davidfetter avatar fiatjaf avatar hraftery avatar mattn avatar mikutas avatar simeji avatar snuggie12 avatar unique1o1 avatar wchargin avatar wodim avatar zmousm avatar

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.