Need Help regarding EXIT condition JSON

Hi Everyone,
Need a bit of Help regarding JSON
My bot places say 5 to 10 Buy orders of CE or PE as and when the conditions are met. Now when condition is met to take TP or SL all these orders need to close, now lets say 5 CE Buy orders are placed with each having qty of 10 lots, Now when the exit condition is met it needs to close the entire qty, i.e 50 Lots, how to create JSON for qty which can be variable.
Regards