If the data returned included array nested into another array, how to configure the JSON tool plugin?

Confluence User - 11 Mar, 2021

Here the e.g of returned data:

{
"data": [
{
"id": "7ea",
"title": "log set Ingress Authentication",
"status": "closed",
"source": "abc",
"alerts": [
{
"type": "Custom",
"description": " defined.",
"first_event": "2018-12-16T08:10:42.068Z"
}
],
"created": "2018-12-16T08:17:18.046Z"
}

And following is the configuration for JSON OBJECTNAME under: PLUGIN CONFIGURATION→STORE TO FORM

data.id

data.title

data.status

data.source

data.alerts.type

data.alerts.description

data.alerts.first_event

data.created

I am getting the data into database table except the alerts: type, description, first_event. Could someone advise how to configure this nested array?

json;saveforms

1


11 Mar, 2021
confluenceUser
confluenceUser

Hi Manjeet,

I just had a look at the source code at specifically at line 271 https://github.com/jogetworkflow/jw-community/blob/7.0-SNAPSHOT/wflow-core/src/main/java/org/joget/apps/app/lib/JsonTool.java#L271

{
    "data": [{
        "id": "7ea",
        "title": "log set Ingress Authentication",
        "status": "closed",
        "source": "abc",
        "alerts": [{
            "type": "Custom",
            "description": " defined.",
            "first_event": "2018-12-16T08:10:42.068Z"
        }],
        "created": "2018-12-16T08:17:18.046Z"
    }]
}


The current implementation is not expecting to hit an array (alerts) inside the first array (data).

Alternatively, you can consider using the Form API Builder and get the external system to call upon Joget's to insert the data in.

Thanks.

Hugo

RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print