I have a problem with fetch command when outputing JSON data that contains wlan authentication-types field. Here is example:
Script 1
:local wifissid [/interface wireless get [ find default-name=wlan1 ] ssid]
/tool fetch http-method=post http-header-field="content-type:application/json" http-data="{\"wifissid\":\"$wifissid\"}" url="http://domain.name/index.php"
Output 1
{"wifissid":"WiFiNetwork123"}
Script 2
:local wifiauthtype [/interface wireless security-profiles get [ find default=yes ] authentication-types]
/tool fetch http-method=post http-header-field="content-type:application/json" http-data="{\"wifiauthtype\":\"$wifiauthtype\"}" url="http://domain.name/index.php"
Output 2
{"wifiauthtype":"wpa-psk"};{"wifiauthtype":"wpa2-psk"}
Second output is not valid JSON file. Is there a way to fix this problem? I think it has to do with parsing field authentication-types that contains , or ;