Bird
0
0

Which of the following is the correct syntax to access a JSON field named userId in a request mapping template?

easy📝 Configuration Q12 of 15
AWS - API Gateway
Which of the following is the correct syntax to access a JSON field named userId in a request mapping template?
A$input.path('$.userId')
B$input.json('userId')
C$input.get('userId')
D$input.body('userId')
Step-by-Step Solution
Solution:
  1. Step 1: Recall JSON path syntax in mapping templates

    The correct way to access a JSON field is using $input.path('$.fieldName').
  2. Step 2: Match the syntax to the field userId

    Using $input.path('$.userId') correctly accesses the userId field.
  3. Final Answer:

    $input.path('$.userId') -> Option A
  4. Quick Check:

    JSON field access = $input.path('$.field') [OK]
Quick Trick: Use $input.path('$.fieldName') to access JSON fields [OK]
Common Mistakes:
  • Using incorrect method names like json or get
  • Missing the '$.' prefix in JSON path
  • Confusing body access with path access

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes