Unable to remove Double quotation from API Response

Hi,

I am authenticating an application via API and getting the response as below,

API Response:
image

Need to remove double qoutation from the above string as below,

Result: sgsjdhfcgdhceuhdcbukreyfberyhfchergfherkfnerkwfah

Kinldy help me on this, Thanks in Advance.

Hi @Dharunya_Devi

How about this expression?

"sgsjdhfcgdhceuhdcbukreyfberyhfchergfherkfnerkwfah".Replace(""""," ")

Regards
Gokul

@Gokul001 ,

tried the above one, its not wokring

Hi @Dharunya_Devi

How about this expression?

"\""sgsjdhfcgdhceuhdcbukreyfberyhfchergfherkfnerkwfah\""".Replace(""""," ").ToString.Replace("\"," ")

Regards
Gokul

the returned string is of:

" "ABCD " "
the outer " are the string markers
the \" - is the qote within the strings

so we do:
grafik

Hi @Dharunya_Devi ,

Maybe we could also try with an alternate as below, maybe the below suits more to your requirement :
image

Hi @supermanPunch @ppr @Gokul001 ,

Tried all the above mentioned approch already,

After doing replace as → string.replace(“”“”,“”)
Now the string is like,
“sgsjdhfcgdh–ceuhdcbukreyfbery.hfchergf-herkfner.kwfah”

But need to remove this double qoutation as well,

Expected result: sgsjdhfcgdh–ceuhdcbukreyfbery.hfchergf-herkfner.kwfah

Hi @Dharunya_Devi

"""sgsjdhfcgdh–ceuhdcbukreyfbery.hfchergf-herkfner.kwfah""".Replace(""""," ")

image

Regards
Gokul

@Dharunya_Devi

A more close to JSON approach is about Deserializing / Value retrieval
grafik

just show us more details from the immediate panel

@Dharunya_Devi ,

Could you maybe provide us with a more transparent look on the data before and after Trim/Replace using a Debug/Immediate Panel or Write Line activity ?

The response is a string and it is not a JSON type,

PFB the response from immediate panel,

image

see last line, it did it

JSONConvert.DeserializeObject(Of String)(apiAuthResponseContent)

grafik

@ppr,

No luck, it is again coming with double qoutes,

image

see the updated post where we showcased and also verified that " is not contained
don’t get mislead from surrounding " in the panels as it is indicating the string markers

If you don’t trust, then write this variable within a text file and as a result, you will see (when done right) that there is no surrounding " in text file content

The same value needs to be used to another HTTP Request for retrieving data, If i pass the value it is showing the reult as bad request.

@ppr , The solution you gave worked, i wrote the string in a text file and read it again. Now there is no Double Qoutes.

Also tried with regex with another pattern which is also working fine,
regex.match(resultString,“"”(.*)"“”).Group(1).Value

Thank you so much everyone for your spontaneous response.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.