Deserialize JSON: Unexpected character encountered while parsing value: {. Path '', line 1, position 1

Hi guys!

I am trying to use the Deserialize JSON activity but I get the error shown in the title of this posts title.

I post POST an API call using the HTTP request activity. When I write line the Result I get the following: {“Message”:“Message Sent”,“Success”:true}

When I put this in the Deserialize JSON activity I get the error.

I’d be grateful for any help here.

Hi @KamKam, can you please send the error screenshot, look like valid json format only.

Hi
This looks fine
Where any special characters like doubles were mentioned before and after this string
Like this
“{“Message”:“Message Sent”,“Success”:true}”

If so remove that and keep only this
{“Message”:“Message Sent”,“Success”:true} In a string variable or in a text file which can be read from a text with READ TEXT FILE ACTIVITY

Cheers @KamKam

1 Like

Not when I put the Result from the HTTP Request activity into the Write Line activity.

In the Locals when I use the debugger it gives me: “{"Message":"Message Sent","Success":true}”

Should I be concerned by the fact that what was given something different in Locals compared to when I use the write line?

no its fine as what came with Locals as it tries to represent it as a string
so assign this in a string variable like this with a assign activity
str_inJson = “{“Message”:“Message Sent”,“Success”:true}”
then pass this as input to Deserialize JSON activity

Cheers @KamKam

Wow, how do you do that?

Provided json is not having any format related issues.
Are you inputting the json text in to deserialize json activity?

like how we did this
can i have a screenshot of it
@KamKam

\b[\w\s]+

Try this Regex code. :crazy_face:

Yes, I am. But it is still giving me the same error.

Maybe the result is having a hidden special characters at the begin/end. Do the trim and verify.

Regex.Unescape

@KamKam

Doesn’t seem to work.

if the only thing you need from the result is to know if it was successful or not and you having all this trouble, then just use a String.contains :laughing:

Restarting my PC and doing the same process in a different Studio instance worked :man_facepalming:

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