Table des matières

json


jq

Installation

Package

sudo apt install jq

Exécutable indépendant

Télécharger le fichier 64 bits ou 32 bits (à exécuter directement) à partir du site https://stedolan.github.io/jq/

Utilisation

Affichage contenu fichier

jq '.' fichier.json

Accès propriété

Lecture de la donnée “toto” dans le fichier fichier.json

jq '.toto' fichier.json

Pour accéder au champ titi de la donnée toto :

jq '.toto.titi' fichier.json

Accès tableau

Interrogation de tous les tableaux :

jq '.[]' fichier.json

Interrogation du 2° tableau :

jq '.[1]' fichier.json

Interrogation propriété toto du premier tableau

jq '.[0].toto' fichier.json

Interrogation propriété toto de tous les tableaux :

jq '.[].toto' fichier.json

jo

https://jpmens.net/2016/03/05/a-shell-command-to-create-json-jo/


JSON Crack

https://jsoncrack.com/editor


Validation

Validation en ligne


Sources

https://blog.madrzejewski.com/jq-traiter-parser-json-shell-cli/
https://unix.stackexchange.com/questions/649526/how-to-edit-a-json-file-using-shell


Haut de page