If you are having only issue of square braclet by using aggregate to json, then you can just use functions to remove that in your next module where you are using this output.
i.e {{substring(output;1;length(output)-1)}}
Regards,
Msquare Automation - Platinum Partner of Make
@Msquare_Automation