Reputation: 627
I'm using the JSON Source Component to consume a REST service which returns page info and total records count on a particular field on the header response:
X-JSON: {"total":1952,"results":100,"limit":100,"skip":0}
Based on KingswaySoft documentation at How to Work with RESTful Endpoints in your SSIS ETL Process
I understood I need to use the GetValueFromPreviousResponseHeaders
function to extract the header variable and GetValueFromJson
to extract the value from json
I tried it but I can't make GetValueFromPreviousResponseHeaders
work.
The function:
GetValueFromJson("{\"total\":1952,\"results\":100,\"limit\":100,\"skip\":0}","$.total")
returns me 1952
so it's ok.
If I substitute the JSON "{\"total\":1952,\"results\":100,\"limit\":100,\"skip\":0}"
with the GetValueFromPreviousResponseHeader
function, it doesn't work:
GetValueFromJson(GetValueFromPreviousResponseHeaders("X-JSON"),"$.total")
Anyone know how it works?
Upvotes: 0
Views: 438
Reputation: 627
I guys, fixed using (DT_I4) a the beginning:
(DT_I4)GetValueFromJson(GetValueFromPreviousResponseHeaders("X-JSON"),"$.total")
Upvotes: 0