title: AWS lambda works but not Gateway
body: <p>On the beginning I would like to mention that I just start learning AWS tools.</p>
  <p>I have two request handlers created with Java. Both of them have the same <code>handleRequest</code> method which looks like one below</p>
  <pre class="lang-java prettyprint-override"><code>public class SecondHandler implements RequestHandler&lt;JSONObject, List&lt;Candidate&gt;&gt; {
   
  
      @Override
      public List&lt;Object&gt; handleRequest(JSONObject request, Context context) {
          List&lt;Object&gt; objectList = new ArrayList&lt;&gt;();
          System.out.println(request + &quot; &lt;&lt;&quot;);
           String isActive = String.valueOf(request.getString(&quot;isActive&quot;));        
          
          if(!isActive) return objectList;
  
          for(Object obj : objectList) {
            // here will go logic
          }
  
        
          return objectList;
      }
  }
  </code></pre>
  <p>First method is used to return some list of object without sending any arguments to it. And it work fine when calling it with AWS lambda, and when using AWS Gateways.</p>
  <p>Second method I am trying to call with sending JSONObject with one filed like</p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;isActive&quot; : &quot;yes&quot;
  }
  </code></pre>
  <p>But when I do the test I am getting error <code>&quot;JSONObject[\&quot;isActive\&quot;] not found.&quot;</code>. And I am sure that this is related to my <code>JSONObject request</code> argument, because when I am changing its type to <code>Map&lt;String, String&gt;</code> it works fine, I am getting what I want when using AWS Lambda. But with <code>Map</code> in place when I try to call this with AWS Gateway I am getting</p>
  <pre class="lang-json prettyprint-override"><code>{ &quot;message&quot; : &quot;Internal server error&quot; }
  </code></pre>
  <p>When checking the logs I can see there is problem with parsing. So basically AWS Gateway can not parse <code>Map&lt;String, String&gt;</code>.</p>
  <p>Could someone tell me, what I do not understand about lambda and gateways? Why those tools have such problem with parsing simple JSON? What I should do?</p>
  <p>PS. I also had the issue with parsing on the first method, when using <code>Map&lt;String, String&gt;</code> that is why I decided to use <code>JSONObject</code>, and that solved the issue for first method.</p>