Deserialize JSON: Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'Newtonsoft.Json.Linq.JToken

Hi All,
I am trying to deserialize in json file Before it was working fine but suddenly i ma getting error like this -

Deserialize JSON: Cannot deserialize the current JSON object (e.g. {“name”:“value”}) into type ‘Newtonsoft.Json.Linq.JToken’ because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
Path ‘data.page’, line 1, position 53.

Please help me

thanks

2 Likes

I hope you are trying to use DeSerialize JsonArray activity.

Which actually requires Json Array as input.

#nK

No I am trying DeSerialize Json only
i want to Dereserialize string data to json

1 Like

What is the type argument you are using in that @Vivek_Kumar4

newton.json.linq.jobject

1 Like

Looks like things are in place. Could you please share your json ?

@Vivek_Kumar4 Check json file data whether data is in json format or not.

{“message”:“Success”,“statusCode”:200,“data”:{“page”:1,“pageSize”:20,“totalItems”:1669,“totalPages”:84,“processes”:[{“process_id”:256,“process_slug”:“simplify—r2-ams—ap–phase-2-”,“process_name”:“Simplify - R2 AMS - AP Email scanning solution (Phase 2)”,“process_description”:"{"blocks":[{"key":"oapi1","text":"AMS Wave 2 - . These need to be printed and scanned into S4 system. In an interface through","type":"unstyled","depth":0,"inlineStyleRanges":,"entityRanges":,"data":{}}],

1 Like

@Nithinkrishna above is sample data

1 Like

Looks like the JSON format is not valid.

Is it the complete json?

#nK

@Vivek_Kumar4 Looks your json format is invalid

No But Same code i was running and getting result
i didn’t change anything but i am getting this error

1 Like

Yes, Thats fine. still here code is fine.

But the data is invalid.

After deserialise i need this output

But i am getting this data from HTTP request
that data i am passing for deserialization

@Vivek_Kumar4 Is it possible to share the data getting from HTTP request

Yes understood. But, there should be some handling for it. To avoid this type of hard errors.

But mostly there wouldn’t be any invalid data response from HTTP client.

#nK

@indra thanks
But i can’t share full data

1 Like

Hi @Vivek_Kumar4

Please try yourself to validate that full json in some online sites please…

#nK