简体   繁体   中英

How to access a look up activity result with special chars in Azure Data factory?

I need to get a attribute with the total number of pages that an API returns so I can control the loop to get all pages. It's small so I created a LookUp activity I must inside a JSON file but the Field names have special chars on it (":") so I have fields like "soapenv:Envelope". Code like this will not work:

@activity('LookupTest').output.value[0].value.soapenv:Envelope.soapenv:Header.hdr:paginacao.hdr:totalPaginas

It Bring me an error.

{"code":"BadRequest","message":null,"target":"pipeline//runid/28573e28-b5ef-41a6-9f8d-2655696193e1","details":null,"error":null}

How can I access it?

The output of LookUp Activity:

{
    "count": 1,
    "value": [
        {
            "soapenv:Envelope": {
                "soapenv:Header": {
                    "mh:messageHeader": {
                        "mh:codigoPerfilAgente": 3801,
                        "mh:transactionId": "d6080aa1-80c2-4743-85e3-a6550a22adda"
                    },
                    "hdr:paginacao": {
                        "hdr:numero": 2,
                        "hdr:quantidadeItens": 30,
                        "hdr:totalPaginas": 2,
                        "hdr:quantidadeTotalItens": 48
                    }
                },
                "soapenv:Body": {
...

I managed to solve converting to string replacing the ":" to "_":

@string(json(replace(replace(string(activity('LookupTest').output.value[0]), 'soapenv:', 'soapenv_'), 'hdr:', 'hdr_')).soapenv_Envelope.soapenv_Header.hdr_paginacao.hdr_totalPaginas)

Does anyone have a more elegant solution?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM