priya.rani
(Priya Rani)
November 24, 2021, 4:32pm
1
Hello Team,
I have been trying to connect to orchestrator API and deserialize the output but I am facing an issue while deseriailizing…
Error Message : “Deserialize JSON: Unexpected character encountered while parsing value: <. Path ‘’, line 0, position 0.”
Could any one help on this topic?
Thanks in Advance,
Srini84
(Srinivas)
November 24, 2021, 4:56pm
2
@priya.rani
Welcome to forums
Check below for your reference
Hi @Raghuveerk
Could you create a new thread and explain your issue in detail?
It would help if you could attach a sample project that causes an issue.
Please also mention the version of Studio that you are using.
As the post explained that try to check whether your JSON is in correct format by going to https://jsonlint.com/
Hope this may help you
Thanks
Probably because the API reply isn’t in JSON format, but some form of XML or even HTML (incorrect requests can easily throw an unathorised or page not found html reply).
Write the raw reply string into your output first, so you know wether it is actual JSON to deserialize.
priya.rani
(Priya Rani)
November 24, 2021, 5:18pm
4
Hello @Srini84 ,
I have already tried that and it says that it is a valid JSON.
Thanks
Can you share that output?
Srini84
(Srinivas)
November 24, 2021, 5:30pm
6
@priya.rani
It’s really helpful to trace the issue if you can upload a sample JSON file
Thanks
priya.rani
(Priya Rani)
November 25, 2021, 3:52pm
7
Hello @Srini84 ,
I have tried testing the JSON file on the mentioned URL and getting the below error:
Error: Parse error on line 1:
< !doctype html > <
^
Expecting ‘STRING’, ‘NUMBER’, ‘NULL’, ‘TRUE’, ‘FALSE’, ‘{’, ‘[’, got ‘undefined’
Could you please check this?
Thanks
priya.rani
(Priya Rani)
November 25, 2021, 3:53pm
8
Hello @Jeroen_van_Loon and @Srini84 ,
Sure, I will check and share the output.
Thanks
Srini84
(Srinivas)
November 25, 2021, 3:54pm
9
@priya.rani
In the Json structure there was multiple things missing
So recheck those, If you are getting this JSON from any other source then you can check else share the sample output file
Thanks
GersonTun
(Gerson Tun)
November 25, 2021, 4:03pm
10
Hi @priya.rani
You can test the response the API is giving you in a page like http://json.parser.online.fr/ so you know the reponse is OK and then try to deserialize it in UiPath.
priya.rani
(Priya Rani)
November 25, 2021, 4:34pm
12
Hello @GersonTun ,
I have checked the JSON in the mentioned URL and it seems the output from http request is not in correct json format.
Thanks
priya.rani
(Priya Rani)
November 25, 2021, 4:35pm
13
Hello @Srini84 @Jeroen_van_Loon ,
it is not allowing me to upload the attachment
priya.rani
(Priya Rani)
November 25, 2021, 5:21pm
16
Though I am not allowed to upload the json file which is a result from http request, pasting in here:
<!doctype html><html lang="en" style="height:100%;scrollbar-width:none"><head><meta charset="utf-8"/><meta name="robots" content="noindex"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/>{"ENVIRONMENT":"prd","FEATURE_FLAGS":{"enable-service-aifabric":{"value":true,"source":"LaunchDarkly"},"IsMultiregionOrgCreationEnabledForPortal":{"value":false,"source":"LaunchDarkly"},"enableAddDirectoryUsers":{"value":false,"source":"LaunchDarkly"},"enable-pm-users-link":{"value":false,"source":"DefaultValuesMap"}}}</body></html>
could you please check?
Thanks
Well there is your answer…
That is not JSON, that is HTML… or at least the outer shell of it. (Hence the illegal <
character on line 0, position 0, the first character in your output)
<!doctype html>
<html lang="en" style="height:100%;scrollbar-width:none">
<head>
<meta charset="utf-8"/>
<meta name="robots" content="noindex"/>
<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/>
{
"ENVIRONMENT":"prd",
"FEATURE_FLAGS": {
"enable-service-aifabric":{
"value":true,
"source":"LaunchDarkly"
},
"IsMultiregionOrgCreationEnabledForPortal":{
"value":false,
"source":"LaunchDarkly"
},
"enableAddDirectoryUsers":{
"value":false,
"source":"LaunchDarkly"
},
"enable-pm-users-link":{
"value":false,
"source":"DefaultValuesMap"
}
}
}
</body>
</html>
So you cannot deserialize it.
Obviously this does not match the requested output you desire. Can you share your activity? What type of request are you sending to the orchestrator?