title: How to extract properties from my state machine output when using EventBridge Input Transformers
body: <p>I'm having trouble passing one of the values returned by my AWS state machine as input to a Lambda using the EventBridge service.</p>
  <p>I created a state machine in AWS Step Functions to model a specific problem in our domain. Once the state machine finishes, I want to perform another operation from inside one of my Lambdas. To make that work, I created a new rule using EventBridge: whenever the state machine finishes, it triggers my lambda with a specific Json input.</p>
  <p>My problem is in how to extract properties from the state machine output and pass them as properties of the lambda input.</p>
  <p>Say my state machine returns this:</p>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;usefulObject&quot;:{
          &quot;usefulProperty&quot;:&quot;value&quot;
      },
      &quot;anotherProperty&quot;:&quot;anotherValue&quot;
  }
  </code></pre>
  <p>I want to receive the following payload in my lambda:</p>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;property&quot;:&quot;value&quot;
  }
  </code></pre>
  <p>Initially, I thought I would be able to do this using the &quot;Input Transformation&quot; option on the EventBridge rule, something like:</p>
  <ul>
  <li>InputTransformer Path:</li>
  </ul>
  <pre class="lang-json prettyprint-override"><code>{&quot;propertyValue&quot;:&quot;$.usefulObject.usefulProperty&quot;}
  </code></pre>
  <ul>
  <li>InputTransformer Template:</li>
  </ul>
  <pre class="lang-json prettyprint-override"><code>{&quot;property&quot;:&lt;propertyValue&gt;}
  </code></pre>
  <p>However, during testing, I realized that the event payload contains a lot more data than my state machine output. In reality, the state machine output is wrapped in this &quot;event container&quot; object, something like this:</p>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;version&quot;: &quot;0&quot;,
      &quot;id&quot;: &quot;...&quot;,
      &quot;detail-type&quot;: &quot;Step Functions Execution Status Change&quot;,
      &quot;source&quot;: &quot;aws.states&quot;,
      &quot;account&quot;: &quot;...&quot;,
      &quot;time&quot;: &quot;2020-11-10T13:59:57Z&quot;,
      &quot;region&quot;: &quot;us-east-1&quot;,
      &quot;resources&quot;: [
          &quot;...myStateMachineArn...&quot;
      ],
      &quot;detail&quot;: {
          &quot;executionArn&quot;: &quot;...myStateMachineExecutionArn...&quot;,
          &quot;stateMachineArn&quot;: &quot;...myStateMachineArn...&quot;,
          &quot;name&quot;: &quot;ff72036a-2917-c657-80e7-2589b7b76d59&quot;,
          &quot;status&quot;: &quot;SUCCEEDED&quot;,
          &quot;startDate&quot;: 1605016794597,
          &quot;stopDate&quot;: 1605016797936,
          &quot;input&quot;: &quot;{\n  \&quot;usefulObject\&quot;:{\n    \&quot;usefulProperty\&quot;: \&quot;value\&quot;\n  },\n  \&quot;anotherProperty\&quot;: \&quot;anotherValue\&quot;\n}&quot;,
          &quot;inputDetails&quot;: {
              &quot;included&quot;: true
          },
          &quot;output&quot;: &quot;{\n  \&quot;usefulObject\&quot;:{\n    \&quot;usefulProperty\&quot;: \&quot;value\&quot;\n  },\n  \&quot;anotherProperty\&quot;: \&quot;anotherValue\&quot;\n}&quot;,
          &quot;outputDetails&quot;: {
              &quot;included&quot;: true
          }
      }
  }
  </code></pre>
  <p>As you can see, in the actual event payload, my statemachine data is stored as a stringified Json value inside the <code>output</code> node. If I then change my Input Transformation path to something like:</p>
  <pre class="lang-json prettyprint-override"><code>{&quot;propertyValue&quot;:&quot;$.detail.output.usefulObject.usefulProperty&quot;}
  </code></pre>
  <p>I get an empty result for <code>property</code> in the transformed input. Turns out, JsonPath is unable to traverse the stringified value as part of the Json payload and will fail on the search.</p>
  <p>How can I extract the <code>usefulProperty</code> value out of that Json string in the event payload so that I can pass it to my lambda function? Is there a way to do it using purely JsonPath that I'm missing? Perhaps there is a way to configure AWS to not convert the payload into a string and just make it part of the whole event payload? Any other alternatives?</p>