We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 038cd71 commit fb2dfceCopy full SHA for fb2dfce
cmd/jsonpath/eval.go
@@ -8,6 +8,7 @@ import (
8
"github.com/bhmj/jsonslice"
9
"github.com/charmbracelet/log"
10
"github.com/spf13/cobra"
11
+ "github.com/tidwall/pretty"
12
)
13
14
func newEvalCommand() *cobra.Command {
@@ -41,7 +42,14 @@ func newEvalCommand() *cobra.Command {
41
42
return err
43
}
44
- fmt.Print(string(result))
45
+ // Format the JSON
46
+ formattedJSON := pretty.Pretty([]byte(result))
47
+
48
+ // Color the JSON
49
+ coloredJSON := pretty.Color(formattedJSON, nil)
50
51
+ // Print formatted and colored JSON
52
+ fmt.Print(string(coloredJSON))
53
54
return nil
55
0 commit comments