title: AWS Step Function Pass entire input as payload in lambda java
body: <p>In one of my step, I am using a lambda function as a task and I want to pass the entire input as the <code>payload</code> so that it can convert to a strong type Java object I defined.</p>
  
  <p>My data type as Object:</p>
  
  <pre><code>@Data
  public class JobMetaData {
  
      public JobMetaData() {
  
      }
  
      private String jobName;
      private String jobId;
  </code></pre>
  
  <p>Lambda Function:</p>
  
  <pre><code>@Override
  public JobMetaData handleRequest(final JobMetaData jobMetaData,
                                   final Context context) {
  </code></pre>
  
  <p>Step:</p>
  
  <pre><code>"Preparing Job": {
    "Next": "Submitting Job",
    "InputPath": "$",
    "OutputPath": "$.bakeJobResult",
    "Type": "Task",
    "Comment": "Preparing Job",
    "Parameters": {
      "FunctionName": "MyLambdaFunctionName",
      "Payload": {
        "$": "$"
      }
    },
    "Resource": "arn:aws:states:::lambda:invoke",
    "ResultPath": "$.bakeJobResult"
  }
  </code></pre>
  
  <p>Above step will result in <code>JobMetaData</code> passed in as <code>null</code>.
  I can only get it work by changing it to: </p>
  
  <pre><code>    "Payload": {
        "jobName.$": "$.jobName",
        "jobId.$": "$.jobId"
      }
  </code></pre>
  
  <p>But if I have a lot of fields, this means I need to extract all json field and construct them again to make it a Payload. I am using CDK to define my state machine, it looks like the <code>Payload</code> part is defined as a <code>Map&lt;String, Object&gt;</code>. Is there a way I can just pass the entire input as payload?</p>