Get List by using Jsonpath
<p>I am using <a href="https://github.com/jayway/JsonPath" rel="nofollow">Jayway JsonPath</a> 2.1.0 to parse a JSON String using JsonPath.</p>

<p>The JSON Structure is as follows:</p>

<pre><code>{
    "status": "",
    "source": "",
    "processedRecords": 1,
    "totalRecords": 4,
    "description": "1 company(ies) added/updated, and 2 company(ies) failed",
    "payload": [{
        "Added/updated company(ies)": [
            "COM001FILE"
        ]
    }, {
        "Failed company(ies)": [{
            "id": "COM003FILE",
            "index": "NA",
            "errorMsg": [
                [
                    "INVALID_LOCATION"
                ]
            ]
        }, {
            "id": "COM002FILE",
            "index": "NA",
            "errorMsg": [
                [
                    "INACTIVE"
                ],
                [
                    "INVALID_LOCATION",
                    "INACTIVE"
                ]
            ]
        }]
    }]
}
</code></pre>

<p>Now the requirement is to get a list of ids whose <code>errorMsg</code> contains <code>INACTIVE</code>. to achieve this I am using filters as shown below.</p>

<pre><code>Filter resposneFilter = Filter.filter(Criteria.where("errorMsg").is(
            "INACTIVE"));
List&lt;Map&lt;String, Object&gt;&gt; respons = JsonPath.parse(response).read(
            "$.payload[*]", resposneFilter);
</code></pre>

<p>but as output I am getting all the values in payload.</p>

<p>Is it possible to get the expected results?</p>