I would like to normalize the following response J...
# replication-troubleshooting
d
I would like to normalize the following response JSON from external API in my python source connector to something simpler. for example i want to create anther JSON where "avgCPA":{"amount": "0.974", "currency": "USD"} to be converted to avgCPA_amount, avgCPA_currency. Is there a pluggable way to do this before sending JSON to the postgres destination.
Copy code
{
  "type": "RECORD",
  "record": {
    "stream": "campaigns",
    "data": {
      "campaigns_report": [
        [
          {
            "other": false,
            "total": {
              "impressions": 1254,
              "taps": 32,
              "installs": 9,
              "newDownloads": 9,
              "redownloads": 0,
              "latOnInstalls": 0,
              "latOffInstalls": 0,
              "ttr": 0.0255,
              "avgCPA": {
                "amount": "0.974",
                "currency": "USD"
              },
              "avgCPT": {
                "amount": "0.274",
                "currency": "USD"
              },
              "avgCPM": {
                "amount": "6.9907",
                "currency": "USD"
              },
              "localSpend": {
                "amount": "8.7664",
                "currency": "USD"
              },
              "conversionRate": 0.2813
            },
            "metadata": {
              "campaignId": 111111,
              "campaignName": "Campaign1",
              "deleted": false,
              "campaignStatus": "ENABLED",
              "app": {
                "appName": "App1",
                "adamId": 1111
              },
              "servingStatus": "RUNNING",
              "servingStateReasons": null,
              "countriesOrRegions": [
                "US"
              ],
              "modificationTime": "2022-08-29T18:23:58.284",
              "totalBudget": null,
              "dailyBudget": {
                "amount": "5",
                "currency": "USD"
              },
              "displayStatus": "RUNNING",
              "supplySources": [
                "APPSTORE_SEARCH_RESULTS"
              ],
              "adChannelType": "SEARCH",
              "orgId": 1,
              "countryOrRegionServingStateReasons": {},
              "billingEvent": "TAPS",
              "countryOrRegion": "US"
            }
          },
          {
            "other": false,
            "total": {
              "impressions": 121,
              "taps": 6,
              "installs": 2,
              "newDownloads": 2,
              "redownloads": 0,
              "latOnInstalls": 0,
              "latOffInstalls": 0,
              "ttr": 0.0496,
              "avgCPA": {
                "amount": "2.265",
                "currency": "USD"
              },
              "avgCPT": {
                "amount": "0.755",
                "currency": "USD"
              },
              "avgCPM": {
                "amount": "37.438",
                "currency": "USD"
              },
              "localSpend": {
                "amount": "4.53",
                "currency": "USD"
              },
              "conversionRate": 0.3333
            },
            "metadata": {
              "campaignId": 222222,
              "campaignName": "Campaign2",
              "deleted": false,
              "campaignStatus": "ENABLED",
              "app": {
                "appName": "App2",
                "adamId": 2222
              },
              "servingStatus": "RUNNING",
              "servingStateReasons": null,
              "countriesOrRegions": [
                "US"
              ],
              "modificationTime": "2022-08-22T17:05:28.945",
              "totalBudget": null,
              "dailyBudget": {
                "amount": "15",
                "currency": "USD"
              },
              "displayStatus": "RUNNING",
              "supplySources": [
                "APPSTORE_SEARCH_RESULTS"
              ],
              "adChannelType": "SEARCH",
              "orgId": 2,
              "countryOrRegionServingStateReasons": {},
              "billingEvent": "TAPS",
              "countryOrRegion": "US"
            }
          }
        ],
        [
          "other",
          "total"
        ]
      ]
    },
    "emitted_at": 1662110857000
  }
}