Reposting as a corrected version of this question. I have reviewed this, but it didn\'t help me deal with unknown array nestings.
Sample data:
const re