Rest API Return Format

46 views
Skip to first unread message

Gagandeep Singh

unread,
Feb 22, 2021, 7:14:10 PM2/22/21
to COZYROC
Hi 

I am trying to extract data from an API. The HTTP returned has the following format

HTTP response data:

{
  "031995E1CFCAE106A531BD014B29D013B8F66C5275F23D8C74DF18E6D6E999F1": {
    "name": " Sub Industry",
    "directory": "Client",
    "category": "MSCI"
  },
  "76B9D1311717B495527B04570DC32A3D730AD6C1E91DE92CDBE65ADB5C757527": {
    "name": "Economic Sector",
    "directory": "DirectoryName",
    "category": "CategoryName"
  }
}

I want to capture "031995E1CFCAE106A531BD014B29D013B8F66C5275F23D8C74DF18E6D6E999F1" in a column but currently am unable to. 

How should I set up the fields in the connection manager? 

Thanks
Gagan 

Ivan Peev

unread,
Feb 23, 2021, 5:24:42 PM2/23/21
to COZYROC
Hi Gagan,

This is an array element. You have to do a slight transformation to get the data into the required format. Define the following JS expression on the Get.Value element for the field:

<Get Value="{{=_.map(value, function(k, v) { return _.extend({ id: k }, v); })}}" />
Reply all
Reply to author
Forward
0 new messages