Hi,
I am authenticating an application via API and getting the response as below,
API Response:
Need to remove double qoutation from the above string as below,
Result: sgsjdhfcgdhceuhdcbukreyfberyhfchergfherkfnerkwfah
Kinldy help me on this, Thanks in Advance.
Gokul001
(Gokul Balaji)
August 19, 2022, 8:29am
2
Hi @Dharunya_Devi
How about this expression?
"sgsjdhfcgdhceuhdcbukreyfberyhfchergfherkfnerkwfah".Replace(""""," ")
Regards
Gokul
@Gokul001 ,
tried the above one, its not wokring
Gokul001
(Gokul Balaji)
August 19, 2022, 8:36am
4
Hi @Dharunya_Devi
How about this expression?
"\""sgsjdhfcgdhceuhdcbukreyfberyhfchergfherkfnerkwfah\""".Replace(""""," ").ToString.Replace("\"," ")
Regards
Gokul
ppr
(Peter)
August 19, 2022, 8:49am
5
the returned string is of:
" "ABCD " "
the outer " are the string markers
the \"
- is the qote within the strings
so we do:
Hi @Dharunya_Devi ,
Maybe we could also try with an alternate as below, maybe the below suits more to your requirement :
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
Gokul001
(Gokul Balaji)
August 19, 2022, 9:00am
9
Hi @Dharunya_Devi
"""sgsjdhfcgdh–ceuhdcbukreyfbery.hfchergf-herkfner.kwfah""".Replace(""""," ")
Regards
Gokul
ppr
(Peter)
August 19, 2022, 9:00am
10
@Dharunya_Devi
Dharunya_Devi:
API Response:
A more close to JSON approach is about Deserializing / Value retrieval
just show us more details from the immediate panel
Dharunya_Devi:
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
@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,
ppr
(Peter)
August 19, 2022, 9:04am
13
see last line, it did it
JSONConvert.DeserializeObject(Of String)(apiAuthResponseContent)
@ppr ,
No luck, it is again coming with double qoutes,
ppr
(Peter)
August 19, 2022, 9:10am
15
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.
system
(system)
Closed
August 22, 2022, 9:57am
17
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.