Hello, I am trying to create a workflow using language comprehension ML skill.
This is not working becuase it is expecting { “paragraph”: "Abraham Lincoln was an American statesman and lawyer who served as the 16th president of the United States from March 1861 until his assassination in April 1865. ", “question”: “Which year did Lincoln pass away?”} but instead I am sending “{"Paragraph":"Abraham Lincoln was an American statesman and lawyer who served as the 16th president of the United States from March 1861 until his assassination in April 1865. ","Question":"Which year did Lincoln pass away"}” NEED TO ELIMINATE ""
Can you please help me to elimintate "" from Json string, I already tried multiple options with .replace method but it did not work. Help please!
Can you llease show them from locals panel…or try to print the value using write line…generally those extra double quotes are to escape the double quotes …so when you print it might print only single
To fix the issue with your JSON string in UiPath, you can use the Deserialize JSON activity and then access the properties directly instead of trying to eliminate double quotes. Here’s how you can approach this:
Deserialize JSON:
Use the Deserialize JSON activity to convert your JSON string into a JObject so that you can work with its properties easily.
Access the properties:
After deserializing, you can access the Paragraph and Question properties as needed.
Please refer to the below thread to know more about accessing json data
Thanks for your reply. This is an jarray, which I am deserializing with “Deserialize JSON Array” but I am not sure if I can remove "" from it. Your solution consist of accessing each element from JArray but I am not sure how to do that. At the end I need a regular array with paragraph and question string to be send as input.
After I deserialize this is what I am getting:
testJsonArray=
JArray(1) { JObject(2) { JProperty(1) { [This is my paragraph] }, JProperty(1) { [this is my question] } } }
How do I access first and second element? is it possible to convert it to regular array?
This is my Json string :
“[{"Paragraph":"This is my paragraph","Question":"this is my question"}]”
This is my deserialized json array:
JArray(1) { JObject(2) { JProperty(1) { [This is my paragraph] }, JProperty(1) { [this is my question] } } }
How can I convert this into a regular array to remove "" this characters?
“{” & “”“paragraph”": "“Abraham Lincoln was an American statesman and lawyer who served as the 16th president of the United States from March 1861 until his assassination in April 1865. “”, ““question””: ““Which year did Lincoln pass away?””}”
Attaching the text file to copy the whole string to use in your project. Paragraph.txt (243 Bytes)