How can I pretty-print a JSON file from the command line?

后端 未结 13 1781
星月不相逢
星月不相逢 2020-12-07 14:32

I\'ve a file with a sequence of JSON element:

{ element0: \"lorem\", value0: \"ipsum\" }
{ element1: \"lorem\", value0: \"ipsum\" }
...
{ elementN: \"lorem\"         


        
相关标签:
13条回答
  • 2020-12-07 15:24

    I always use json_reformat

    echo '{"test":"value", "test2":"value2"}' | json_reformat
    
    {
        "test": "value",
        "test2": "value2"
    }
    

    Could be installed by apt-get install yajl even under Windows in MobaXTerm

    0 讨论(0)
提交回复
热议问题