Not sure what you mean by JSON for each, but if you are using a for each loop for any object then you will know the final number of the loop by using object.count-1. So to find the loop end you would check for if loopindex = object.count-1
the -1 is because the count is zero based
demo: onedrive.live.com/redir