Skip to main content
Question

Generate new JSON to send to API

  • March 13, 2026
  • 0 replies
  • 10 views

Bernaldo
Forum|alt.badge.img+2

Hi,

We need to transform the structure of an JSON array into another JSON array with different fields and structure using the 1st array values in order to POST it into an API.

In a playbook starting with a “Siemplify_Get Case Details” step, we retrieve all the entities from the case, using  [Siemplify_Get Case Details_1.JsonResult| "entityCards"], as far as we see is where the case entity fields are located, and has an structure like this:

 

"entityCards":[

    {
        "identifier":"XXXXXXXXXXX",
        "type":"HOSTNAME",
        "suspicious":false,
        "linkedEntities":[
        ]
    },
    {
        "identifier":"1.1.1.1",
        "type":"ADDRESS",
        "suspicious":false,
        "linkedEntities":[
        ]
    },
    {
        "identifier":"XXXXXXX",
        "type":"HOSTNAME",
        "suspicious":false,
        "linkedEntities":[
            {
                "identifier":"2.2.2.2",
                "type":"ADDRESS",
                "suspicious":false,
                "linkedEntities":[
                ],
                "direction":20
            }
        ]
    },

How we can transform that JSON array in another JSON array with different structure, something like:

 

[{

"dataType_1": "identifier1",

"data_1": [],

"message": "string"

},

{

"dataType_2": "identifier2",

"data_2": [],

"message": "string"

}

]

 

Basically it’s a matter of format in order to POST it into an API.

 

Best regards