Quantcast
Channel: MikroTik
Viewing all articles
Browse latest Browse all 21064

Scripting • Re: Test if array is associative, multi-dimensional, or simple list

$
0
0
FWIW, while no "pretty print"... v7.13 has JSON support as built-in function
Yip I'm aware thanks, and I expect I will swap to that eventually as I've no interest in reinventing the wheel - I've been using that script for the last few years on 6.x and early 7.x thus a script as a workaround. I have 7.13.4 on test gear but not rolled out everywhere yet.
I'm in the same boat.

I notice your comments about YAML. I have an example of array to YAML here: viewtopic.php?t=199581&hilit=yaml – more complex since can "tee" outputs to a file ($YAML file=out.yaml $myarray), but there is a regex inside to know if strings need to be escaped in YAML that might be useful if your were going to add YAML to your script.

I actually mainly use my $YAML function to "debug" arrays at the terminal... since ":put $myarray" output the ";element;;;" stuff make it hard to know WTF structure it has.

Statistics: Posted by Amm0 — Tue Feb 13, 2024 6:15 pm



Viewing all articles
Browse latest Browse all 21064

Trending Articles