Database Insert with subtable

I have managed to get this to work, fetching an API response, and inserting data into my database primary and sub table, however, the only way I could make it work was to adjust my database column names to be identical to the “Key”: “Value” returned by the API.

Is there a way to get around this, where the database column name could be different.
API Response.

    "name": "Paul",
    "lastName": "Strydom",
    "contacts": [
            "phone": "1234567"
            "phone": "9999999"

If my database table where the “phone” will be entered has a column named “phone” then this works.

If the column is named something like “user_phone_numbers” then it errors with a message

Unknown column 'phone' in 'field list'

If there was a way to map the API Keys in the sub arrays / objects to my database field names that would be ideal.
Or of course there is also always the distinct possibility I am just doing this wrong, if someone could please confirm.

Community Page
Last updated: