Working with JSON files can quickly become cumbersome, especially when dealing with large or nested structures. While tools like cat or less display raw JSON, they offer little in terms of readability. Fortunately, jq, the lightweight and powerful command-line JSON processor, provides a simple yet effective solution: the --color-output flag.

Basic Usage

To format and colorize a JSON file, use the following command:

jq --color-output . file1.json

--color-output: Enables syntax highlighting. .: The filter that outputs the entire JSON structure. file1.json: Your input JSON file.

Going Further

For more advanced jq usage, check out my previous article: /jq: A JSON Command Line Swiss Knife.