Community discussions

MikroTik App
 
User avatar
doneware
Trainer
Trainer
Topic Author
Posts: 647
Joined: Mon Oct 08, 2012 8:39 pm
Location: Hungary

:put and /environ print differences

Sun Nov 25, 2018 11:43 pm

consider the following code:
admin@mfx-XXXXXXXXXXX] /system gps> :global ttt [/interface bridge host print detail as-value  where bridge=bridge1 ]
it produces this variable data:
[admin@mfx-XXXXXXXXXXX] /system gps> :put $ttt
.id=*23;age=00:00:54;bridge=bridge1;comment=;interface=*7;mac-address=00:00:00:FF:FF:F2;on-interface=mfxl2tp;.id=*1f;age=00:01:53;bridge=bridge1;comment=;interface=*7;mac-address=10:F3:11:2B:92:C1;on-interface=mfxl2tp;.id=*20;bridge=bridge1;comment=;interface=bridge1;mac-address=B8:69:F4:9E:FF:46;on-interface=bridge1;.id=*22;age=00:00:42;bridge=bridge1;comment=;interface=ether1;mac-address=CC:CC:81:EB:FF:2F;on-interface=ether1;.id=*21;age=00:00:42;bridge=bridge1;comment=;interface=*7;mac-address=E0:AC:F1:2E:93:86;on-interface=mfxl2tp
now if i check under /environment, it looks a lot more tidy:
[admin@mfx-991309D578CA] /system gps> /environment print 
ttt={{.id=*23; age=00:00:54; bridge="bridge1"; comment=""; interface="*7"; mac-address="00:00:00:FF:FF:F2"; on-interface="mfxl2tp"}; {.id=*1f; age=00:01:53; bridge="bridge1"; comment=""; interface="*7"; mac-address="10:F3:11:2B:92:C1"; on-interface="mfxl2tp"}; {.id=*20; bridge="bridge1"; comment=""; interface="bridge1"; mac-address="B8:69:F4:9E:FF:46"; on-interface="bridge1"}; {.id=*22; age=00:00:42; bridge="bridge1"; comment=""; interface="ether1"; mac-address="CC:CC:81:EB:FF:2F"; on-interface="ether1"}; {.id=*21; age=00:00:42; bridge="bridge1"; comment=""; interface="*7"; mac-address="E0:AC:F1:2E:93:86"; on-interface="mfxl2tp"}}
this last one is almost like JSON, which is nice. if i post the "array of arrays" as multipart-form-data, it ends up garbled on the other side. if i post it as text, it looks like the output of ":put", which is again not optimal. (i could live with that, but it is just not ok). how do i get this {}-grouped output on the far end?

Who is online

Users browsing this forum: No registered users and 79 guests