 <p>The easiest way to compare json strings is using <code>JSONCompare</code> from <a href="https://github.com/skyscreamer/JSONassert" rel="nofollow">JSONAssert</a> library. The advantage is, it's not limited to structure only and can compare values if you wish:</p> <pre><code>JSONCompareResult result = JSONCompare.compareJSON(json1, json2, JSONCompareMode.STRICT); System.out.println(result.toString()); </code></pre> <p>which will output something like:</p> <pre><code>Expected: VALUE1 got: VALUE2 ; field1.field2 </code></pre>