Hallo.
I have an json string, when i write it to the console or workbook it looks correct.
But when i try to use it in UiPath, it gives me dobbelt quotes like this:
@"[
{
““FullName””: ““Tonmmy Dehl””,
““PhoneNumber””: "“111111111"”,
““Day””: true,
““Night””: false
},
{
““FullName””: ““Deas Dem””,
““PhoneNumber””: ““22222222"”,
““Day””: false,
““Night””: true
}
]”
I have tried different things using .replace() but nothing is working, can someone please help
it should look like this:
@“[
{
“FullName”: “Tonmmy Dehl”,
“PhoneNumber”: “111111111”,
“Day”: true,
“Night”: false
},
{
“FullName”: “Deas Dem”,
“PhoneNumber”: “22222222”,
“Day”: false,
“Night”: true
}
]”
rlgandu
(Rajyalakshmi Gandu)
July 2, 2024, 12:35pm
2
@christian.bendtsen
Assign activity
To: correctedJsonString
Value: jsonString.Replace("""", """").Replace("““", """").Replace("”", """")
Hi @christian.bendtsen
Check the below thread,It might helps you
@hadrian.araujo
Welcome to the forum
we hope that not particular visualisation is mistaken
[grafik]
Similar also to:
[grafik]
in_StrContactInfo.Replace(“”“”, “”“”).Replace(“““”, “”“”).Replace(“””, “”“”) gives me an error like this:
Error ERROR Validation Error Compiler error(s) encountered processing expression “in_StrContactInfo.Replace(”“”“, “””“).Replace(”“““, “””“).Replace(””“, “””“)”.(1) : error BC30027: ‘End Function’ expected.
(2) : error BC30648: String constants must end with a double quote.
(3) : error BC30198: ‘)’ expected.
(3) : error BC30198: ‘)’ expected.
(2) : error BC30516: Overload resolution failed because no accessible ‘Replace’ accepts this number of arguments. Misc/Misc_SentDataToAPI.xaml
hey
I have already seen that, but i can make it work, can you give an example?
@christian.bendtsen ,
This is from Immediate/Local panel right?
It’s normal thing. No need to replace it. Pass this to whatever activity you are trying to pass. There should not be an issue.
If any issue, put that here.
Thanks,
Ashok
1 Like
Hi @christian.bendtsen ,
Could you show us a screenshot of how/where you get the visualization in the format same as provided by you ?
rlgandu
(Rajyalakshmi Gandu)
July 2, 2024, 12:49pm
8
@christian.bendtsen
jsonString.Replace("“", """").Replace("”", """").Replace("""", "").Replace("""", "")
Hey Ashok
It is from the Immediate/local, reason why i think thats the problem is bacause, when i pass a normal string in with the correct json format, to the API, then it works fine…
@christian.bendtsen ,
Any specific error you are getting with this format?
replaceCom…xaml (5.3 KB)
text.txt (301 Bytes)
regex.txt (23 Bytes)
Please try this workfloaw, i think it should work fine
inside of regex file is
””|““|””|““
inside of the text file
`[
{
““FullName””: ““Tonmmy Dehl””,
““PhoneNumber””: ““111111111””,
““Day””: true,
““Night””: false
},
{
““FullName””: ““Deas Dem””,
““PhoneNumber””: ““22222222"”,
““Day””: false,
““Night””: true
}
]
after you have read the files, input is the string from text file and regex is the string from regex file, add those two vrbl in assign activity System.Text.RegularExpressions.Regex.Replace( input, regex,"""")