|
|
|
|
|
by h4l
717 days ago
|
|
Powershell has the upper hand here! Still, bash can try to keep up using json.bash. :) $ source json.bash
$ declare -A greeting=([Hello]=World)
$ json ...@greeting:{}
{"Hello":"World"}
... is splatting the greeting associative array entries into the object created by the json call.Without the ... the greeting would be a nested object. Probably more clear with multiple entries: $ declare -A greeting=([Hello]=World [How]="are you?")
$ json @greeting:{}
{"greeting":{"Hello":"World","How":"are you?"}}
Vs: $ json ...@greeting:{}
{"Hello":"World","How":"are you?"}
|
|