Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: C. Path '', line 0, position 0

I have created the same project as in this YouTube (UiPath Tutorial For Beginners - JSON Parsing - YouTube) but am getting the error above. Seems to be something to do with the file path.

I can’t attach the files sorry

2 Likes

@cbpeters81 We would need more details, at least screenshots of how you are reading the file and the json file. You could also check some online JSON validators to see if your JSON is valid.

@cbpeters81
its easy you can do this…

In order to read the json files

  1. First use read text document with input of that json file path and output as a variable of type string named out_txt

  2. Then use a deserialize json activity with input as out_txt and output as out_json.This out_json should be of type jobject…newtonsoft.json.linq from browse type in the variables panel
    To get this activity deserialize json download the package UiPath.web.activities.

  3. Then use a writeline or anyother data feed activity like type into with input as out_json.Getvalues(“your left side key word in json”).ToString

Alright till this you would have done as per the video…let me tell you the common issues that you will face here…

Error 1… Your @cbpeters81 would be because of datatype of the json output variable or input variable…clear them…
Input Datatype : string
Output Datatype : jobject

Error 2… Jobject no defined, this occurs though you have mentioned the type as jobject for variable out_json…

To clear this just go to manage packages and in dependencies…update the below packages…

  1. UiPath.system.activities
  2. UiPath.web activities

This error will get cleared, then…

Hope this would help you…kindly let know if you are facing any other issues…

Cheers

Is that working…
Cheers.

The JSON is ok. I checked the Validator.

Will try to throw up some visuals

It looks like you are passing the file path instead of the actual json string to the Deserialize activity.

image

image

image

system activities is on the latest version 19.4
web activities was installed today and is on 1.4.1

Error 1 - bother are defined as above I believe.

The error is here. You are providing the file path instead of JSON string you got from reading the JSON file.

1 Like

@cbpeters81
Use deserialize json instead of deserialize json array…and use a variable with type jobject instead of jarray…and pass this to for each loop and change the type of this loop to strings…

Cheers…

Thanks. Got it now.

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