title: How to parse JSON in rest assured stepdefination class?
body: <p>Below is the JSON request body:
  {
  &quot;memberId&quot;:&quot;21bda54e-895a-4528-8788-698fce5b5&quot;,
  &quot;prodList&quot;:[
  {
  &quot;productCode&quot;:&quot;312&quot;
  }
  ]
  }</p>
  <p>Below is the code which I have written. Let me know How to parse the above JSON payload in the rest assured step definition file.</p>
  <p>public class Generate_Bill {</p>
  <pre><code>private Response response;
  private String accessToken;
  private void jsonBodyUsingMap(String string, List singletonList) {
      // TODO Auto-generated method stub
      
  }
  public String generateStringFromResource(String path) throws Throwable {
  
      return new String(Files.readAllBytes(Paths.get(path)));
  
  }
  
  @Given(&quot;Post Generate Bill API&quot;)
  public void post_Generate_Bill_API() {
      RestAssured.baseURI = Initialization.url;
  }
  
  @When(&quot;call the Post Generate Bill API with valid token and details&quot;)
  public void call_the_Post_Generate_Bill_API_with_valid_token_and_details() throws Throwable {
  
      accessToken = TokenGeneration.accessToken;
      String jsonBody = generateStringFromResource(&quot;src/test/java/request/Generate_Bill.json&quot;);
  
      //Gson gson = new Gson();
      //JsonObject inputObj  = gson.fromJson(jsonBody, JsonObject.class);
  
      Map&lt;String, Object&gt; jsonBodyUsingMap = new HashMap&lt;String, Object&gt;();
      
      // singletonList() to return an immutable list containing only the specified object
      jsonBodyUsingMap(&quot;prodList&quot;, Collections.singletonList(new HashMap&lt;String, Object&gt;() {
      {
          put(&quot;productCode&quot;, &quot;31&quot;);
      }}
      ));
      
          jsonBodyUsingMap.put(&quot;memberId&quot;, &quot;21bda54e-895a-4528-8788-6985f6fce5b5&quot;);
      
  
  response = RestAssured.given()
          .header(&quot;Content-Type&quot;, &quot;application/json&quot;)
          .header(&quot;Authorization&quot;, &quot;Bearer &quot; + accessToken)
          .when()
          .post(Initialization.Generate_Bill);    
  
  }
  
  
  @Then(&quot;validate Generate Bill API for {int} status code&quot;)
  public void validate_Generate_Bill_API_for_status_code(Integer int1) {
      int status_code = response.getStatusCode();
      System.out.println(&quot;status is: &quot; +status_code);
      Assert.assertEquals(200, status_code);
  }
  </code></pre>
  <p>}</p>