Skip to content

elken/consult-jq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

consult-jq

Overview

A minimal integration between jq and consult for interactive JSON filtering in Emacs.

demo.mp4

This package provides a live-updating interface to filter JSON data in your current buffer. As you type a jq filter in the minibuffer, the results are displayed with syntax highlighting. Press RET to copy the result to the kill ring.

Requirements

  • Emacs 29.1 or newer
  • jq

Installation

Using straight.el and use-package

(use-package consult-jq
  :straight (:host github :repo "elken/consult-jq")
  :commands (consult-jq))

Manual

  1. Clone the repository
  2. Add to your load path
  3. Require the package
(add-to-list 'load-path "/path/to/consult-jq")
(require 'consult-jq)

Usage

Open a JSON file and run:

M-x consult-jq

Type a jq filter to see the results update in real-time. Press RET to copy the result to the kill ring.

Shorthand filters

The package provides several shorthand filters for common operations:

  • keys - Show all object keys
  • items - Show keys as separate items
  • values - Show all values
  • types - Show types of all values

Customization

You can customize the available shorthand filters:

(setq consult-jq-filter-alist
      '(("items" . "keys[]")
        ("types" . "map_values(type)")
        ("count" . "length")))  ;; Added custom shorthand

About

Live JSON filtering via consult

Topics

Resources

License

Stars

Watchers

Forks