Hi,
I also found one that uses JSON...
For the moment you have to use string concatenation to replace the variables. There's probably not going to be a much better way in the short term. I could try to detect when the format is JSON and then use another way to replace the variables, however this is quite complicated and probably fails in some cases.
Example to use string concatenation:
Original:
Code: Select all
putString("parameters", '{"advancedSettings":{"deviceName":"{variable}","sendCustomMessage":false}}');
New:
Code: Select all
putString("parameters", '{"advancedSettings":{"deviceName":"' + variable + '","sendCustomMessage":false}}');
Alternatively, you can break the string into multiple parts. The parts with variable replacements have to be wrapped in double quotes:
Code: Select all
putString("parameters", '{"advancedSettings":{"deviceName":"' + "{variable}" + '","sendCustomMessage":false}}');
I find it quite interesting that the author of the auto-tools has decided to switch to this JSON-approach, since the plugin itself will break quite easily in all automation tools when the replaced text contains a value that looks like JSON or when it just contains double quotes etc.
Assume that variable contains the value
abc"123. Automagic will replace the variable and will pass the plugin following text:
Code: Select all
{"advancedSettings":{"deviceName":"abc"123","sendCustomMessage":false}}
That's not valid JSON anymore so the plugin can not even parse the JSON value.
Maybe the author of the plugin is not aware about this issue
I'll try to contact the developer of the plugins...
Regards,
Martin