Living in the Shell; jq (JSON) [LS#4]

jq 🧹

JSON formatter/prettifier.

🏠 https://stedolan.github.io/jq/
đź“— https://github.com/stedolan/jq

Installation (on Debian)

sudo apt-get install jq

Format/prettify

echo -n ‘{“who”:[“me”,”you”],”when”:”now”}…


This content originally appeared on DEV Community and was authored by Babak K. Shandiz

jq 🧹

JSON formatter/prettifier.

🏠 https://stedolan.github.io/jq/
đź“— https://github.com/stedolan/jq

Installation (on Debian)

sudo apt-get install jq

Format/prettify

echo -n '{"who":["me","you"],"when":"now"}' | jq
{
  "who": [
    "me",
    "you"
  ],
  "when": "now"
}

Indentation with tab --tab

echo -n '{"who":["me","you"],"when":"now"}' | jq --tab

Compact -c

cat << EOF | jq -c
{
  "who": [
    "me",
    "you"
  ],
  "when": "now"
}
EOF
{"who":["me","you"],"when":"now"}

Sort keys -S

echo -n '{"z":"z","a":"a"}' | jq -S
{
  "a": "a",
  "z": "z"
}

Uncolorize output (monochrome) -M

echo -n '{"who":"me","when":"now"}' | jq -M


This content originally appeared on DEV Community and was authored by Babak K. Shandiz


Print Share Comment Cite Upload Translate Updates
APA

Babak K. Shandiz | Sciencx (2021-11-26T18:14:49+00:00) Living in the Shell; jq (JSON) [LS#4]. Retrieved from https://www.scien.cx/2021/11/26/living-in-the-shell-jq-json-ls4/

MLA
" » Living in the Shell; jq (JSON) [LS#4]." Babak K. Shandiz | Sciencx - Friday November 26, 2021, https://www.scien.cx/2021/11/26/living-in-the-shell-jq-json-ls4/
HARVARD
Babak K. Shandiz | Sciencx Friday November 26, 2021 » Living in the Shell; jq (JSON) [LS#4]., viewed ,<https://www.scien.cx/2021/11/26/living-in-the-shell-jq-json-ls4/>
VANCOUVER
Babak K. Shandiz | Sciencx - » Living in the Shell; jq (JSON) [LS#4]. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/11/26/living-in-the-shell-jq-json-ls4/
CHICAGO
" » Living in the Shell; jq (JSON) [LS#4]." Babak K. Shandiz | Sciencx - Accessed . https://www.scien.cx/2021/11/26/living-in-the-shell-jq-json-ls4/
IEEE
" » Living in the Shell; jq (JSON) [LS#4]." Babak K. Shandiz | Sciencx [Online]. Available: https://www.scien.cx/2021/11/26/living-in-the-shell-jq-json-ls4/. [Accessed: ]
rf:citation
» Living in the Shell; jq (JSON) [LS#4] | Babak K. Shandiz | Sciencx | https://www.scien.cx/2021/11/26/living-in-the-shell-jq-json-ls4/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.