Process Model Cant Write a List to the DB

My process model has an integration task that calls an API and then follows up to write into my database, but I keep getting this error when I run it:

Cannot index property 'property' of type Text into empty List of Dictionary) (Data Outputs)

From what I'm understanding is that the PM can't write a List ({}) to the DB and rightfully so. So in my expression for the output I have this:

if(
    length(
        rule!myIntegration().result.body.people.person.address
    ) =0,"",
    rule!myIntegration().result.body.people.person.address.state.value)

I try to tell the expression, that if the List ({}) is empty (or length of 0), then to make it an empty string ("") so it can write an empty string to the DB instead of a List (why the error happens), otherwise if not empty or not 0, to add the value to the DB. I would think this work but I keep getting this error. My JSON API string is as follow:

{    
    "people": [
        {
            "id": 1,
            "person": {
                "address": { 
                    "state": { "value": "VA" }
                }
            }
        },
        {
            "id": 2,
            "person": {
                "address": {}
            }
        }
    ]
}


As you can see, the second user is what I'm trying to take into account in the expression. I've tried it many different ways and for some reason I still get this error.

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data