I have a string that contains JSON data and I want to convert it to string or string array in C#.
I'm getting exception of type JSONReaderException
Additional text encountered after finished reading JSON content: :. Path '', line 1, position 7
What is the meaning of it?
Here is my code:
string requestType = Request.QueryString[0].ToString();
JObject json = JObject.Parse(requestType);
JavaScriptSerializer j = new JavaScriptSerializer();
string b = JsonConvert.DeserializeObject<string>(requestType.Substring(1,requestType.Length-2));
The data is sent to the server from AJAX request. I'm attaching the request:
$.ajax({
url: "AJAXRequests.aspx",
type: "get",
data: JSON.stringify({ "first": "getevent","second":"data" }),
dataType:'json',
success: function (response){
},
error: function (xhr) {
alert("Problem in sending data to the server.\n Please check your internet connection and try again");
}
});