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
diff options
context:
space:
mode:
-rw-r--r--sh/jshn.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/sh/jshn.sh b/sh/jshn.sh
index c973692..1d30557 100644
--- a/sh/jshn.sh
+++ b/sh/jshn.sh
@@ -199,6 +199,16 @@ json_add_fields() {
# functions read access to json variables
+json_compact() {
+ JSON_NONEWLINE=1
+ JSON_INDENT=
+}
+
+json_pretty() {
+ JSON_NONEWLINE=
+ JSON_INDENT=1
+}
+
json_load() {
eval "`jshn -r "$1"`"
}
@@ -208,7 +218,7 @@ json_load_file() {
}
json_dump() {
- jshn "$@" ${JSON_PREFIX:+-p "$JSON_PREFIX"} -w
+ jshn "$@" ${JSON_PREFIX:+-p "$JSON_PREFIX"} ${JSON_NONEWLINE:+-n} ${JSON_INDENT:+-i} -w
}
json_get_type() {