From: Felix Fietkau Date: Sat, 19 Oct 2013 22:00:42 +0000 (+0200) Subject: jshn: add json_get_keys() X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4bc1a3a46be02bda354eb4f81f809e48d2fdb215;p=oweals%2Flibubox.git jshn: add json_get_keys() Signed-off-by: Felix Fietkau --- diff --git a/sh/jshn.sh b/sh/jshn.sh index b4bb1e1..110892c 100644 --- a/sh/jshn.sh +++ b/sh/jshn.sh @@ -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