mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
global-functions: $ParseJson: handle outher curly brackets
This commit is contained in:
parent
bb899b1fb0
commit
7df4f9e78c
1 changed files with 6 additions and 1 deletions
|
@ -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={
|
||||
|
|
Loading…
Reference in a new issue