Problem with parsing a Json with invalid characters

Hi,

I have a string that I am trying to parse into a json:

When I parse it, I get the error:
Assign: Unexpected character encountered while parsing value: @. Path ‘’, line 0, position 0.

I understand that the ‘@’ indicates that it’s some kind of raw string and shouldn’t actually be included in any output, so then why am I unable to parse it?

I’ve tried to remove the @ with substring, remove even replace but I cannot remove it (again, I understand that it doesn’t actually ‘exist’ in the string, yet I am desperate for a solution).

Thanks a lot for your help!

Hi,

Can you share your string a file using WriteTextFile activity?

Regards,

json.txt (1.9 KB)

Hi,

Can you try the following expression?

strJson = strJson.Trim({"@"c,""""c,Chr(10),Chr(13)}).Replace("""""","""")

Sample20230828-1L.zip (3.2 KB)

Regards,

1 Like

It works when outputting it to a message box:

but when the string is parsed as a jObject, it still gives the error

Did you run the above sample : Sample20230828-1L.zip ?
It works in deserialize to JObject without error.

Regards,

Thank worked @Yoichi! Thank you so much, you are a king

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.