Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-10-20 02:00:42 +0400
committerFelix Fietkau <nbd@openwrt.org>2013-10-20 02:00:42 +0400
commit4bc1a3a46be02bda354eb4f81f809e48d2fdb215 (patch)
tree20109cd6a09d8a8f2f40ee5fc9270e8929f96624 /sh
parent734d28eb1a46358743cf8837c91e5d46695c3b91 (diff)
jshn: add json_get_keys()
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'sh')
-rw-r--r--sh/jshn.sh9
1 files changed, 9 insertions, 0 deletions
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