Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»General Articles»How to Pretty Print JSON file in Linux Shell Script

    How to Pretty Print JSON file in Linux Shell Script

    By RahulJune 5, 20191 Min Read

    The json_pp is a command line utility available in Linux systems to print JSON output in pretty format. It can format the JSON content in file or results of other commands by passing with the pipe.

    Advertisement

    For example, I have a file fruit.json conaiting some json content but not in proper format.

    cat fruit.json
    
    {"fruit": "Apple", "size": "Large","color": "Red"}
    

    Now, send the json content to the json_pp command via the pipe. You will find the results in a pretty format, which can be easily read.

    cat myfile.json | json_pp
    

    Output:

    {
       "color" : "Red",
       "fruit" : "Apple",
       "size" : "Large"
    }
    

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    How to Split Large Archives in Linux using the Command Line

    System.out.println() Method in Java: A Beginner’s Guide

    sleep Command in Linux with Examples

    Add A Comment

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • How to Split Large Archives in Linux using the Command Line
    • System.out.println() Method in Java: A Beginner’s Guide
    • Split Command in Linux With Examples (Split Large Files)
    • Test Your Internet Speed from the Linux Terminal
    • 11 Practical Example of cat Command in Linux
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.