hey,
you can nest an element with repeated items into another element with repeated items and put inside that construction properly organized JSON.
I recorded the video with the similar approach: Tree like multi selection - #3 by Batik_Okazov
Try it out and tag me with the result.