Skip to content

A small wrapper over jp for querying over json buffer in Emacs.

License

Notifications You must be signed in to change notification settings

UnresolvedCold/jmespath

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Readme

JMESPath Query for Emacs

This is a small utility that uses jp underneath to query your JSON buffer and displays the result in a new buffer named *JMESPath Result*.

Dependencies

jp command line utility

Please refer jmespath repository to know more about the jp command line utility.

Usage

Query a buffer

  1. Open a JSON file.
  2. Run the function using M-X jmespath-query-and-show.
  3. Enter your JMESPath query and press enter.

Query a file

  1. Run the function with universal-argument set, C-u M-x jmespath-query-and-show
  2. Enter your JMESPath query and press enter.
  3. Enter the file you want to query on and press enter.

Get the result in your program

You can use jmespath-query-buffer and jmespath-query-file in yout program to run the query and get the result as string output.

Example

Query a buffer

Open a scratch buffer or open the below source code in org special edit.

{"employees":[
    {"name":"Shyam", "email":"[email protected]"},
    {"name":"Bob", "email":"[email protected]"},
    {"name":"Jai", "email":"[email protected]"}
]}

Run the query @.employees[*].name by typing M-X jmespath-query to get an array of employee names.

The output would be something like this.

[
  "Shyam",
  "Bob",
  "Jai"
]

About

A small wrapper over jp for querying over json buffer in Emacs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published