aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-10-13 22:41:28 +0200
committerGravatar Christian Hesse <mail@eworm.de>2023-10-16 23:43:58 +0200
commitc0aab0feadd1ede2cc2d900811f0678f8901de6a (patch)
tree4364c1810afc3fbc9066dcdce0c0adcd640c7653
parent3b9df48721c6cb6c3018581749cdbcb6442774a5 (diff)
global-functions: $ParseJson: properly handle array
-rw-r--r--global-functions.rsc13
1 files changed, 13 insertions, 0 deletions
diff --git a/global-functions.rsc b/global-functions.rsc
index 8dc8c02..8d06cb1 100644
--- a/global-functions.rsc
+++ b/global-functions.rsc
@@ -723,6 +723,19 @@
:set Skip 2;
:set Done true;
}
+ :if ($Done = false && $Val1 = ":[") do={
+ :local Tmp "";
+ :local End;
+ :set Skip 1;
+ :do {
+ :set Skip ($Skip + 1);
+ :local ValX ($Input->($I + $Skip));
+ :set End [ :pick $ValX ([ :len $ValX ] - 1) ];
+ :set Tmp ($Tmp . "},{" . $ValX);
+ } while=($End != "]");
+ :set ($Return->$Key) ("{" . [ :pick $Tmp 0 ([ :len $Tmp ] - 1) ] . "}");
+ :set Done true;
+ }
:if ($Done = false) do={
:set ($Return->$Key) [ :pick $Val1 1 [ :len $Val1 ] ];
:set Skip 1;