Key and value without double quotes in JSON

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?

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

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}

Hi @bbgl

Have an look on the Document

Regards
gokul

Hi @bbgl

Just have try the following

Regards
Gokul

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

Yes, I replaced all the data with the word test.
json.txt (3.7 КБ)

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

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

  • 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