Converting an API response JSON to the an existing CDT

Hi, One of my APIs returns a JSON file and this needs to be passed to a CDT. The API returns the JSON KVP in Camel format but the CDT which existed and in extensive use has its fields setup with 'underscores'. Is there a way that once my Appian application received the API response it can be converted before setting the info to the existing CDT

An examples;

JSON response

{
     "companyId1":"1",
     "companyId2":"2",
     "companyId3":"3",
     "companyId4":"4",
}

CDT

company_id_1

company_id_2

company_id_3

company_id_4

Thanks

  Discussion posts and replies are publicly visible

  • If the response is single then use below code

    load(
    local!jsonResponse: {
    "companyId1": "1",
    "companyId2": "2",
    "companyId3": "3",
    "companyId4": "4",

    },
    type!CDT(
    company_id_1: local!jsonResponse.companyId1,
    company_id_2: local!jsonResponse.companyId2,
    company_id_3: local!jsonResponse.companyId3,
    company_id_4: local!jsonResponse.companyId4
    )
    )

    If the response is multiple  then use below code

    load(
    local!jsonResponse: {
    "companyId1": "1",
    "companyId2": "2",
    "companyId3": "3",
    "companyId4": "4",

    },
    a!forEach(
    items: local!jsonResponse,
    expression: type!CDT(
    company_id_1: fv!item.companyId1,
    company_id_2: fv!item.companyId2,
    company_id_3: fv!item.companyId3,
    company_id_4: fv!item.companyId4
    )
    )
    )