After upgrading to Madrid release, ActiveDirectory PS module returns one more pair of square brackets by "ConvertTo-Json" introduced in PRB1273432.
For example, when testing input using QueryAD activity, if the result is empty, the output in London release is 
in Madrid, the output is []
As a result, any activity post processing or condition that's built on '' will start failing after upgrade to Madrid.
Steps to Reproduce
On any London instance, try testing input of activity "Query AD", put in search filter like samaccountname=testtest, the output should be 
In Madrid, do the same, the output will be [].
This can also be verified in ECC > Queue.
In London, run Query AD, check ecc, we get:
In Madrid, we get:
If you are able to upgrade, review the "Intended Fix Version" section below below to determine the versions that have a permanent fix.
If upgrade is not possible, you can use below workaround.
(Please note: once an out of box script is changed, it will be skipped during platform upgrade.
Then you can either manually revert it to OOB after platform upgrade, or follow below doc to force it to be overwritten during platform upgrade:
Overwrite customizations during an upgrade
In MID Server > Script Files > activedirectory.psm1, change below
Write-Host -NoNewline "<![CDATA[[$json]]]>";
Write-Host -NoNewline "<![CDATA[$json]]>";
(removed one pair of )
Related Problem: PRB1337502