2025-03-14 21:59:59 -06:00
|
|
|
# ajson
|
|
|
|
|
|
|
|
|
|
> Exécute un JSONPath sur un objet JSON.
|
2026-02-18 06:55:01 -07:00
|
|
|
> Plus d'informations : <https://github.com/spyzhov/ajson#console-application>.
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Lis un JSON depuis un fichier et exécute une expression JSONPath spécifique :
|
|
|
|
|
|
|
|
|
|
`ajson '{{$..json[?(@.path)]}}' {{chemin/vers/fichier.json}}`
|
|
|
|
|
|
|
|
|
|
- Lis un JSON depuis l'entrée standard et exécute une expression JSONPath spécifique :
|
|
|
|
|
|
|
|
|
|
`cat {{chemin/vers/fichier.json}} | ajson '{{$..json[?(@.path)]}}'`
|
|
|
|
|
|
|
|
|
|
- Lis un JSON depuis une URL et évalue une expression JSONPath spécifique :
|
|
|
|
|
|
|
|
|
|
`ajson '{{avg($..price)}}' '{{https://exemple.com/api/}}'`
|
|
|
|
|
|
|
|
|
|
- Lis un JSON simple et calcule une valeur :
|
|
|
|
|
|
|
|
|
|
`echo '{{3}}' | ajson '{{2 * pi * $}}'`
|