diff options
author | Felix Fietkau <nbd@openwrt.org> | 2013-10-20 02:00:42 +0400 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2013-10-20 02:00:42 +0400 |
commit | 4bc1a3a46be02bda354eb4f81f809e48d2fdb215 (patch) | |
tree | 20109cd6a09d8a8f2f40ee5fc9270e8929f96624 /sh | |
parent | 734d28eb1a46358743cf8837c91e5d46695c3b91 (diff) |
jshn: add json_get_keys()
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'sh')
-rw-r--r-- | sh/jshn.sh | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -205,6 +205,15 @@ json_get_type() { eval "export -- \"$__dest=\${$__var}\"; [ -n \"\${$__var+x}\" ]" } +json_get_keys() { + local __dest="$1" + local _tbl_cur + + json_get_var _tbl_cur "$2" + local __var="${JSON_PREFIX}KEYS_${_tbl_cur}" + eval "export -- \"$__dest=\${$__var}\"; [ -n \"\${$__var+x}\" ]" +} + json_get_var() { local __dest="$1" local __cur |