bbgl
(Alex)
February 9, 2022, 7:43am
1
Hi all!
From some system I get a response in the form of json, but deserialize with standard methods I can not because it has no double quotes, not the key and value.
Example of json
{
Created: 02/07/2022 11:01:02 UTC,
CreatedByID: d321cca5-2a63-4b1a-9fc2-4473edd19f72,
CreatedByName: “Alex”,
Flags: 0,
ID: e957934b-ce37-4abd-b395-c13cbc282379,
Modified: 02/07/2022 11:01:21 UTC
}
Can you tell me how to deserialize it?
Gokul001
(Gokul Balaji)
February 9, 2022, 7:53am
2
Hi @bbgl
Go to Manage package → All Package → Uipth.Web.Activities → Install the package
Use Deserialize JSON Activity
Use Assign Activity
Deserialize JSON_Output.GetValue(“ID”).ToString
Output → e957934b-ce37-4abd-b395-c13cbc282379
Refer to the screenshot
Refer the Document for Deserialize
Regards
Gokul
bbgl
(Alex)
February 9, 2022, 8:11am
3
Thanks for the quick reply, but that’s exactly what I’m doing. When I try to deseritize, an error comes up. Deserialize JSON: Error parsing comment. Expected: *, got 0. Path ‘Created’, line 1, position 13.
{\r\n Created: 02/07/2022 11:01:02 UTC,\r\n CreatedByID: d321cca5-2a63-4b1a-9fc2-4473edd19f72,\r\n CreatedByName: "Трифонова Анна Александровна",\r\n Flags: 0,\r\n ID: e957934b-ce37-4abd-b395-c13cbc282379,\r\n Modified: 02/07/2022 11:01:21 UTC,\r\n ModifiedByID: d321cca5-2a63-4b1a-9fc2-4473edd19f72}
Gokul001
(Gokul Balaji)
February 9, 2022, 8:29am
4
Hi @bbgl
Have an look on the Document
Regards
gokul
Gokul001
(Gokul Balaji)
February 9, 2022, 8:32am
5
Hi @bbgl
Just have try the following
[2018error]
This error may occur when you are trying to run a workflow after upgrading to 18.1 version without “killing” UiRobot.exe from task manager before the upgrade or you have installed both 2017.1 .msi and 18.1 .exe
Troubleshooting:
Uninstall the 2017.1 version(if you have it)
Kill any UiRobot.exe processes from Task manager and run again from Studio. Please note that the updated Studio and Robot will be in this folder: %localappdata%\UiPath\app-18.1.1 under the names UiStudio.exe a…
Regards
Gokul
ppr
(Peter Preuss)
February 9, 2022, 9:33am
6
may we ask you to share the JSON as txt file with us. In general we can think about a correction flow, but in general the JSON is invalid, when it occurs in this format as described
bbgl
(Alex)
February 9, 2022, 12:07pm
7
Yes, I replaced all the data with the word test.
json.txt (3.7 КБ)
ppr
(Peter Preuss)
February 9, 2022, 12:29pm
8
unclear what was meant with this. Still we do doubt, that an api is returning an invalid JSON.
However a repair strategie with regex.replace could look like this:
[CheatSheet] - System.Text.RegularExpressions | RegEx - News / Tutorials - UiPath Community Forum
bbgl
(Alex)
February 9, 2022, 4:04pm
9
I thought there was a way to set up the deserialize without using a regular expression to set double quotes.
If it’s not difficult, is there a regular expression for setting double quotes in the value
ppr
(Peter Preuss)
February 9, 2022, 4:08pm
10
be in doubt on invalid JSON sent by API
unfortunately, we did not receive a feedback on what was meant
keep in mind that not all values are to be surrounded with quotes e.g. numbers, null