Legacy Dev Forum Posts

 View Only

Sign Up

Data Action - Issues with filter operators

  • 1.  Data Action - Issues with filter operators

    Posted 06-05-2025 18:47

    lcreely | 2024-12-17 15:19:06 UTC | #1

    I'm trying to figure out how to handle JSON where null values get removed from the JSON

    {
      "expand": "schema,names",
      "startAt": 0,
      "maxResults": 50,
      "total": 4,
      "issues": [
        {
          "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
          "id": "482154",
          "self": "https://example.atlassian.net/rest/api/2/issue/482154",
          "key": "SD-91151",
          "fields": {
            "summary": "Issue related to system configurations and alerts",
            "status": {
              "self": "https://example.atlassian.net/rest/api/2/status/10496",
              "description": "This was auto-generated by Jira Service Management during workflow import",
              "iconUrl": "https://example.atlassian.net/images/icons/status_generic.gif",
              "name": "Waiting for support",
              "id": "10496",
              "statusCategory": {
                "self": "https://example.atlassian.net/rest/api/2/statuscategory/4",
                "id": 4,
                "key": "indeterminate",
                "colorName": "yellow",
                "name": "In Progress"
              }
            }
          }
        },
        {
          "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
          "id": "470330",
          "self": "https://example.atlassian.net/rest/api/2/issue/470330",
          "key": "SD-86422",
          "fields": {
            "summary": "Communication system issues affecting operations",
            "status": {
              "self": "https://example.atlassian.net/rest/api/2/status/10496",
              "description": "This was auto-generated by Jira Service Management during workflow import",
              "iconUrl": "https://example.atlassian.net/images/icons/status_generic.gif",
              "name": "Waiting for support",
              "id": "10496",
              "statusCategory": {
                "self": "https://example.atlassian.net/rest/api/2/statuscategory/4",
                "id": 4,
                "key": "indeterminate",
                "colorName": "yellow",
                "name": "In Progress"
              }
            }
          }
        },
        {
          "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
          "id": "462387",
          "self": "https://example.atlassian.net/rest/api/2/issue/462387",
          "key": "SD-83244",
          "fields": {
            "summary": "Setup of network configurations for internal platform",
            "assignee": {
              "self": "https://example.atlassian.net/rest/api/2/user?accountId=6426ff032cee496759ed9848",
              "accountId": "6426ff032cee496759ed9848",
              "emailAddress": "example.user1@domain.com",
              "avatarUrls": {
                "48x48": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/6426ff032cee496759ed9848/25d7dd8d-13c7-4825-a1a0-afd9125a1ae5/48",
                "24x24": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/6426ff032cee496759ed9848/25d7dd8d-13c7-4825-a1a0-afd9125a1ae5/24",
                "16x16": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/6426ff032cee496759ed9848/25d7dd8d-13c7-4825-a1a0-afd9125a1ae5/16",
                "32x32": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/6426ff032cee496759ed9848/25d7dd8d-13c7-4825-a1a0-afd9125a1ae5/32"
              },
              "displayName": "User One",
              "active": true,
              "timeZone": "Europe/Dublin",
              "accountType": "atlassian"
            },
            "status": {
              "self": "https://example.atlassian.net/rest/api/2/status/10498",
              "description": "This was auto-generated by Jira Service Management during workflow import",
              "iconUrl": "https://example.atlassian.net/images/icons/status_generic.gif",
              "name": "Pending",
              "id": "10498",
              "statusCategory": {
                "self": "https://example.atlassian.net/rest/api/2/statuscategory/4",
                "id": 4,
                "key": "indeterminate",
                "colorName": "yellow",
                "name": "In Progress"
              }
            }
          }
        },
        {
          "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
          "id": "379279",
          "self": "https://example.atlassian.net/rest/api/2/issue/379279",
          "key": "SD-55762",
          "fields": {
            "summary": "Issue with administrative configuration in system",
            "assignee": {
              "self": "https://example.atlassian.net/rest/api/2/user?accountId=712020%3A03543b68-e7d3-4b6b-973c-b5e7bd91b907",
              "accountId": "712020:03543b68-e7d3-4b6b-973c-b5e7bd91b907",
              "emailAddress": "example.user2@domain.com",
              "avatarUrls": {
              },
              "displayName": "User Two",
              "active": true,
              "timeZone": "Europe/London",
              "accountType": "atlassian"
            },
            "status": {
              "self": "https://example.atlassian.net/rest/api/2/status/10496",
              "description": "This was auto-generated by Jira Service Management during workflow import",
              "iconUrl": "https://example.atlassian.net/images/icons/status_generic.gif",
              "name": "Waiting for support",
              "id": "10496",
              "statusCategory": {
                "self": "https://example.atlassian.net/rest/api/2/statuscategory/4",
                "id": 4,
                "key": "indeterminate",
                "colorName": "yellow",
                "name": "In Progress"
              }
            }
          }
        }
      ]
    }

    In this example assignee doesn't exist for all issues and I can't default it to null values so I'm trying to separate them instead using filter options as stated here: GitHub - json-path/JsonPath: Java JsonPath implementation.

    My translation map

    {
      "translationMap": {
        "assigneesAssigned": "$.issues[?(@.fields.assignee)].fields.assignee.displayName",
        "statusesAssigned": "$.issues[?(@.fields.assignee)].fields.status.name",
        "ticketSummariesAssigned": "$.issues[?(@.fields.assignee)].fields.summary",
        "ticketKeysAssigned": "$.issues[?(@.fields.assignee)].key",
        "assigneesUnassigned": "$.issues[?(!@.fields.assignee)].fields.assignee.displayName",
        "statusesUnassigned": "$.issues[?(!@.fields.assignee)].fields.status.name",
        "ticketSummariesUnassigned": "$.issues[?(!@.fields.assignee)].fields.summary",
        "ticketKeysUnassigned": "$.issues[?(!@.fields.assignee)].key"
      },
      "translationMapDefaults": {
        
      },
      "successTemplate": "{\"KeysAssigned\": ${ticketKeysAssigned}, \"SummariesAssigned\": ${ticketSummariesAssigned}, \"AssigneesAssigned\": ${assigneesAssigned}, \"StatusesAssigned\": ${statusesAssigned}, \"KeysUnassigned\": ${ticketKeysUnassigned}, \"SummariesUnassigned\": ${ticketSummariesUnassigned}, \"StatusesUnassigned\": ${statusesUnassigned}}"
    }

    I'm getting a response like so:

    {
      "KeysAssigned": [
        "SD-91151",
        "SD-86422",
        "SD-83244",
        "SD-55762"
      ],
      "StatusesAssigned": [
        "Waiting for support",
        "Waiting for support",
        "Pending",
        "Waiting for support"
      ],
      "SummariesAssigned": [
        "Redacted ",
        "Redacted",
        "Redacted",
        "Redacted"
      ],
      "AssigneesAssigned": [
        "User One",
        "User Two"
      ],
      "Issues.KeysAssigned": [
        null
      ],
      "Issues.SummariesAssigned": [
        null
      ],
      "Issues.AssigneesAssigned": [
        null
      ],
      "Issues.StatusesAssigned": [
        null
      ],
      "Issues.KeysUnassigned": [
        null
      ],
      "Issues.SummariesUnassigned": [
        null
      ],
      "Issues.StatusesUnassigned": [
        null
      ]
    }

    Am I missing something with my filter operators? I should only be seeing two values for each


    Jerome.Saint-Marc | 2024-12-17 17:56:09 UTC | #2

    Hello,

    The processed response you have included at the end of your post (with KeysAssigned, StatusesAssigned , ...) doesn't seem to correspond to the Response Configuration and the sample response/example you are showing at the beginning of your post.

    Using the first response example (on a simulated web service) and your response configuration, this is what I get:

    {
      "KeysAssigned": [
        "SD-83244",
        "SD-55762"
      ],
      "SummariesAssigned": [
        "Setup of network configurations for internal platform",
        "Issue with administrative configuration in system"
      ],
      "AssigneesAssigned": [
        "User One",
        "User Two"
      ],
      "StatusesAssigned": [
        "Pending",
        "Waiting for support"
      ],
      "KeysUnassigned": [
        "SD-91151",
        "SD-86422"
      ],
      "SummariesUnassigned": [
        "Issue related to system configurations and alerts",
        "Communication system issues affecting operations"
      ],
      "StatusesUnassigned": [
        "Waiting for support",
        "Waiting for support"
      ]
    }

    My output contract is:

    {
      "type": "object",
      "properties": {
        "KeysAssigned": {
          "type": "array",
          "items": {
            "title": "Item 1",
            "type": "string"
          }
        },
        "StatusesAssigned": {
          "type": "array",
          "items": {
            "title": "Item 1",
            "type": "string"
          }
        },
        "SummariesAssigned": {
          "type": "array",
          "items": {
            "title": "Item 1",
            "type": "string"
          }
        },
        "AssigneesAssigned": {
          "type": "array",
          "items": {
            "title": "Item 1",
            "type": "string"
          }
        },
        "KeysUnassigned": {
          "type": "array",
          "items": {
            "title": "Item 1",
            "type": "string"
          }
        },
        "SummariesUnassigned": {
          "type": "array",
          "items": {
            "title": "Item 1",
            "type": "string"
          }
        },
        "StatusesUnassigned": {
          "type": "array",
          "items": {
            "title": "Item 1",
            "type": "string"
          }
        }
      },
      "additionalProperties": true
    }

    Regards,


    system | 2025-01-17 17:56:12 UTC | #3

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 30894