title: How do you compare an entire Json file to it's response using restassured?
body: <p>I'm using restassured something I used a few years back. When doing so I had a folder with Json files in my project. I was comparing these to the actual outcome of the API response. What is the best way to go about this. I obviously need my file location in my project and need to compare it to my response. Is there a standard way to do this.</p>
  <p>So originally I had this. Just to check the City from the body but I want the whole thing.</p>
  <pre><code>    @Test
  public void GetCity() {
  
      given().
              when().
              get(city).
              then().
              assertThat().
              body((&quot;city&quot;), equalTo(city));
  }
  </code></pre>
  <p>But I want to get to something like this below:</p>
  <pre><code>@Test
  public void GetCity() {
  
      given().
              when().
              get(city).
              then().
              assertThat().
              JsonFile((&quot;/Myjson&quot;), equalTo(response));
  }
  </code></pre>
  <p>I'm using TestNg currently but I remembered using Cucumber Scenarios which allowed me to test multiple responses in a data table. Question I have is how do I achieve the above?</p>
  <pre><code>    {
    &quot;id&quot;: 25,
    &quot;first_name&quot;: &quot;Caryl&quot;,
    &quot;last_name&quot;: &quot;Ruberry&quot;,
    &quot;email&quot;: &quot;cruberryo@smugmug.com&quot;,
    &quot;ip_address&quot;: &quot;222.10.201.47&quot;,
    &quot;latitude&quot;: 11.8554828,
    &quot;longitude&quot;: -86.2183907,
    &quot;city&quot;: &quot;Dolores&quot;
  }
  </code></pre>