JSON Query Filter Help

I have a task that hits a url and returns the results in JSON array like this:

  1. “json”: {
    “statuses”: [
    {
    “application”: “JIRA”,
    “completeKey”: “com.atlassian.jira.plugins.jira-healthcheck-plugin:hsqlHealthCheck”,
    “description”: “Checks if the instance is connected to an HSQL or H2 database”,
    “documentation”: “https://confluence.atlassian.com/x/1guaEQ”,
    “failureReason”: “You are not using an HSQL or H2 embedded database with a production license.”,
    “healthy”: true,
    “id”: 0,
    “isHealthy”: true,
    “name”: “Embedded database”,
    “severity”: “undefined”,
    “tag”: “Supported Platforms”,
    “time”: 1518726326309
    },
    {
    “application”: “JIRA”,
    “completeKey”: “com.atlassian.jira.plugins.jira-healthcheck-plugin:eolHealthCheck”,
    “description”: “Checks if the running version of JIRA is approaching, or has reached End of Life.”,
    “documentation”: “https://confluence.atlassian.com/x/HjnRLg”,
    “failureReason”: “Unable to verify the End of Life date for version ‘7.4.x’. The check has not been performed.”,
    “healthy”: true,
    “id”: 0,
    “isHealthy”: true,
    “name”: “End of Life”,
    “severity”: “undefined”,
    “tag”: “Supported Platforms”,
    “time”: 1518726326316
    },
    {
    “application”: “JIRA”,
    “completeKey”: “com.atlassian.jira.plugins.jira-healthcheck-plugin:luceneSupportHealthCheck”,
    “description”: “Checks the state of the search index is consistent with the database.”,
    “documentation”: “https://confluence.atlassian.com/x/9IUfL”,
    “failureReason”: “The issue index is inconsistent with the database state.”,
    “healthy”: false,
    “id”: 0,
    “isHealthy”: false,
    “name”: “Lucene”,
    “severity”: “major”,
    “tag”: “Indexing”,
    “time”: 1518726326372
    },

The two tasks that run looks like this:

`

Honestly, I try to stay away from json_query when possible, and stick to just standard jinja2 pipelines:

“{{ (results.json.statuses|selectattr(‘name’, ‘match’, ‘Lucene’)|list|first).isHealthy }}”

You can use a variety of tests instead of match, such as search or equalto.

@Matt - that worked perfectly. I’m assuming that the jinja2 pipeline you added as a sample works as follows:

It pipes the results from my results variable grabbing only the json.statuses data structure, selects the attribute name that matches the value Lucene and from that data structure or position, look for the first isHealthy key and give me only that result. Do I have that correct?

That is correct.