Currently my data return from graphql query is in format and have 1200 questions from my http data source and want to return only first 10 through graphl in response mapping template.
{
"data": {
"questions":[
{
questions:"ques 1"
},
{
questions:"ques 2"
}, ....
]
}
}
My response mapping template code look likes this for slicing on aws appsycn(VTL direct resolver)
#if($ctx.result.statusCode == 200)
$ctx.result.body.data.questions.slice(0,10)
But getting error message:
Unable to convert $ctx.result.body.data.questions.slice(0,10)\n to Object"
i have tries to return via $util.toJson()
also, but still facing same error.