Share jq friendly JSON printing tips under Linux

  • 2020-03-30 04:21:54
  • OfStack

Moving on to the answer below, there is a gadget called jq that seems to be good, and the test download does meet the requirements.

Json | jq '.'
You get a formatted result

Let me introduce jq to you in detail

Jq's official website: (link: http://stedolan.github.io/jq/)

Download the binary can call directly, after detailed installation see: (link: http://stedolan.github.io/jq/download/)

Easy to use:
1. Json file friendly display


cat jsonfile | path_to_jq/jq . 

2. Get the value of a key in json

cat jsonfile | path_to_jq/jq ".key" 

More operations, see: (link: http://stedolan.github.io/jq/manual/)


Related articles: