how to handle nested lists in AWS APIG Mapping Template in VTL
<p>(Here's my Model scheme:</p>

<pre><code>{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "QuestionsModel",
"type": "array",
"items": {
"type": "object",
"properties": {
    "section_name": { "type": "string" },
    "options" : { 
        "type" : "array",
        "items" : {
            "type" : "array",
            "items" : {
                "type" : "string"
            }
        }
    }
}
</code></pre>

<p>Here's the Mapping template:</p>

<pre><code>#set($inputRoot = $input.path('$'))
[
#foreach($question in $inputRoot) {
    "section_name" : "$question.section_name.S",
    "options" : [
    #foreach($items in $question.options.L) {
    [
        #foreach($item in $items.L) {
        "$item.S"
        }#if($foreach.hasNext),#end
        #end
    ]        
    }#if($foreach.hasNext),#end
    #end
    ]

}#if($foreach.hasNext),#end

#end
]
</code></pre>

<p>Although this syntax correctly maps the data it results in "options" being an empty array.</p>

<p>Without the "options" specified then my iOS app receives valid JSON. But when I try various syntaxes for "options" then I either get invalid JSON or an "Internal Service Error" and CloudWatch isn't much better offering <code>Unable to transform response</code>.</p>

<p>The options valid is populated with this content: <code>{L=[{"L":[{"S":"1"},{"S":"Dr"}]},{"L":[{"S":"2"},{"S":"Mr"}]},{"L":[{"S":"3"},{"S":"Ms"}]},{"L":[{"S":"4"},{"S":"Mrs"}]},{"L":[{"S":"5"},{"S":"Prof."}]}]}</code> which is provided by a Lambda function.</p>

<p>I can only conclude, at this point, that API Gateway VTL doesn't support nested arrays.</p>