Unable to execute Deserialize json activity for json string

Dear,

Please see below-attached image. I am getting this error while performing Deserialize json activity to get the json object.

With same data this activity is working fine in another system.

Would you please help asap?

@sourabhnamdev999

Can you check the json is in correct format?

Paste the Json value in https://codebeautify.org/jsonviewer and click on beautify

If it is showing the Json structure correctly then JSON is valid, else it has some errors

Hope this will help you

Thanks

As mentioned, ensure the JSON is valid.
From the error message also check

Deserialize JSON - when Json is representing a JSON object, { "Prop1": .....
Deserialize JArray - when Json is representing a JSON Array, [....

Hi,

That is correct. The same data is working in other systems.

Yes, it’s valid. and It is json object

So, it should be parseable with the Deserialize JSON Activity

How did you handled, implemented? Maybe you can share the JSON and/or some screenshots from your implementation

Hi,
By the error it seems, the json string you are parsing is a JSON array and not simple json.
To confirm if it is a JSON array, check if it is in below format. The point to note here is square brackets in value of “employees” key which makes the value an array of jsons.

{“employees”:[
{“name”:“Ram”, “email":"ram@gmail.com”, “age”:23},
{“name”:“Shyam”, “email":"shyam23@gmail.com”, “age”:28},
{“name”:“John”, “email":"john@gmail.com”, “age”:33},
{“name”:“Bob”, “email":"bob32@gmail.com”, “age”:41}
]}

Try using Deserialize Json Array activity.

Another way to verify what is it’s type is as below.
Write line below code:
JToken.Parse(your json string).GetType.toString

If the output is ‘newtonsoft.json.linq.jarray’ then it is a JSON array and you need to use Deserialize Json Array activity else simple Deserialize Json.

So if you are not sure what your input will be, put and if condition by using above code to get type and work accordingly.

Let me know if this helps.

I run the Process, Json type is JSON object which I am passing JSON Deserialize activity to get JSON object.