aboutsummaryrefslogtreecommitdiffstats
path: root/global-functions.rsc
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-10-10 12:54:59 +0200
committerGravatar Christian Hesse <mail@eworm.de>2023-10-16 11:51:04 +0200
commit7df4f9e78c9213dfb1bb9e423e1d55d2bc01dd6d (patch)
tree9a5707dc711ef77044f0170830fe4f23f673efdb /global-functions.rsc
parentbb899b1fb0b20d481fafc7d67193ab003c33a652 (diff)
global-functions: $ParseJson: handle outher curly brackets
Diffstat (limited to 'global-functions.rsc')
-rw-r--r--global-functions.rsc7
1 files changed, 6 insertions, 1 deletions
diff --git a/global-functions.rsc b/global-functions.rsc
index 12d510b..df374b8 100644
--- a/global-functions.rsc
+++ b/global-functions.rsc
@@ -698,11 +698,16 @@
# parse JSON into array
# Warning: This is not a complete parser!
:set ParseJson do={
- :local Input [ :toarray $1 ];
+ :local Input [ :tostr $1 ];
:local Return ({});
:local Skip 0;
+ :if ([ :pick $Input 0 ] = "{") do={
+ :set Input [ :pick $Input 1 ([ :len $Input ] - 1) ];
+ }
+ :set Input [ :toarray $Input ];
+
:for I from=0 to=[ :len $Input ] do={
:if ($Skip > 0 || $Input->$I = "\n" || $Input->$I = "\r\n") do={
:if ($Skip > 0) do={