Click here to Skip to main content
15,881,380 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This issue comes on live server. In local IIS its working.

for deserialize i am uing

var data = JsonConvert.DeserializeObject<dataset>(response.Content);

this is my json:

{"Table":[{"OrganisationID":1001,"NAME":"LORD MEHER INTER COLLEGE","Type":1,"Code":"HS0101","SiteUrl":"http://school.com/HS0101/Home/Login",
"IsOnline":false,"OwnerName":"MR NIGAM","OwnerContact":"9858758510","OwnerEmail":"TEST@gmail.com","Address":"631/K-139, GAUTAM NAGAR, NOIDA","Pincode":"201301","COUNTRY":"INDIA","STATE":"UTTAR PRADESH","CITY":"NOIDA"}]}

What I have tried:

i have removed all null values from json.
Posted
Updated 1-Jul-22 4:26am

A quick google search shows that you are likely not passing JSON into the deserialize object method.

c# - Unexpected character encountered while parsing value - Stack Overflow[^]

Given you didn't provide much of a code sample, I'm going to say that response.Content isn't actually a string and is where you issue is coming in.

You need to ensure that response.Content is a string and not a HttpResponseMessage.

Also, if response.Content is how I think it is being used. You probably need to use it with the ReadAsString method in order to get it into a string format for Deserialization.
 
Share this answer
 
var respContent = await response.Content.ReadAsStringAsync();

var data = JsonConvert.DeserializeObject<dataset>(respContent);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900