From 4bc1a3a46be02bda354eb4f81f809e48d2fdb215 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 20 Oct 2013 00:00:42 +0200 Subject: [PATCH] jshn: add json_get_keys() Signed-off-by: Felix Fietkau --- sh/jshn.sh | 9 +++++++++ 1 file changed, 9 insertions(+) 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 -- 2.25.1