⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Tirito6626/bash2json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 

Repository files navigation

bash2json

The most bash-based JSON parser

logo

  • Pure bash without any external commands
  • JSON trim/validation/query/append
  • Recursive Associative/indexed arrays to JSON and vice versa
  • Pipes support
  • Single executable

Usage examples:

Getting "world":

./bash2json --query '{ "hello": "world" }' 'hello'
"world"

Getting "good":

root@bash2json: ./bash2json --query '{ "hello": { "world": "good" } }' 'hello.world'
"good"

Removing double quotes:

root@bash2json: ./bash2json --query -r '{ "hello": { "world": "good" } }' 'hello.world'
good

Appending root JSON:

root@bash2json: ./bash2json --append '{ "hello": "world" }' 'goodbye' 'world'
{"hello":"world","goodbye":"world"}

Appending 'hello' object:

root@bash2json: ./bash2json --append '{ "hello": { "world": "good" } }' 'hello.goodbye' 'world'
{"hello":{"world":"good","goodbye":"world"}}

Converting JSON into associative array:

root@bash2json: ./bash2json --from-json '{ "hello": { "world": "good", "goodbye": "world" } }'
declare -Ag array_25528=([hello.world]="good" [hello.goodbye]="world")

About

The most bash-based JSON parser

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages