Pulling values from "nested" CDT

I currently have data being pushed into a CDT in the following format: 

 

Questions_CDT

{

QuestionID: 1,

AnswerIDs: {1,2,3}

},

{

QuestionID: 2,

AnswerIDs: {3}

}

And I need it to format to: 

{

    QuestionID: 1,

    AnswerID: 1

},

{

    QuestionID: 1,

    AnswerID: 2

},

{

    QuestionID: 1,

    AnswerID: 3

},

{

QuestionID: 2,

AnswerID: 3

}

 

What would be the best way to accomplish this? I've tried nested a!foreach loops but to no avail. Any suggestions? 

  Discussion posts and replies are publicly visible