Last active
January 23, 2024 05:58
-
-
Save NotFounds/444d26b47c56488b60c138b2fbee5bfb to your computer and use it in GitHub Desktop.
A script to interactively narrow down JSON Paths from a JSON file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function jpath() { | |
local JSONFILE=$1 | |
local _paths=$(jq -cr 'paths | map(if type=="number" then "[" + tostring + "]" else "." + tostring end) | join("")' $JSONFILE) | |
local _path=$(echo "$_paths" | fzf --preview "echo {} | xargs -I path jq 'path' $JSONFILE") | |
echo "$_path" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment