成果物
使い方
関数をロードする。
. ./Jsonify.sh
連想配列変数KV
にキーと値をセットする。
unset KV declare -A KV KV['Id']=100 KV['Name']='Yamada' KV['height']='175.1'
JSON文字列を返す関数を呼び出す。
Jsonify
{"Id":100,"height":175.09999999999998898,"Name":"Yamada"}
SQLite3を使わずBashだけで行う。
JsonifyFromBash Id 100 Name 'Yamada' height '175.1'
{"Id":100,"Name":"Yamada","height":175.1}
所感
SQLite3の.mode json
がなくてもできちゃった。
対象環境
- Raspbierry pi 4 Model B
- Raspbian buster 10.0 2019-09-26 ※
- bash 5.0.3(1)-release 学習まとめ
- SQLite 3.33.0 ※ 学習まとめ
$ uname -a Linux raspberrypi 4.19.97-v7l+ #1294 SMP Thu Jan 30 13:21:14 GMT 2020 armv7l GNU/Linux