title: How to validate complex JSONObjects in a JUnit test?
body: <p>How can I properly validate fields of a <code>JSONObject</code> in a <code>JUnit</code> <code>@Test</code>?</p>
  
  <pre><code>{
      "persons": [
          "adults": [
              {
                  "name": ".."
                  "age": ..
              },
              {
                  "name": ".."
                  "age": ..
              }
          ]
      ]
  }
  </code></pre>
  
  <p>I mean, if testing on a spring-managed webservice, I could use <code>jsonPath()</code> similar as follows:</p>
  
  <pre><code>mockMvc.perform(get("/")).andDo(print()).andExpect(status().isOk())
      .andExpect(jsonPath("$.persons[0].adults[0].name", is("John")));
  </code></pre>
  
  <p>But I'm not using a webservice here, but want to validate just a json object.</p>
  
  <p>Could I anyhow make somehow usw of the <code>jsonPath()</code> method of spring, or are there similar techniques?</p>