Ekskalibbur
Ekskalibbur

Reputation: 11

Json : Unexpected character encountered while parsing value: s. Path '', line 0, position 0

This Code;

public void ProcessRequest(HttpContext context)
{
    string jSon = new StreamReader(context.Request.InputStream).ReadToEnd();
    string result = LETSGO.BUSINESS.Process.ApiProcesRequest(jSon);        
    context.Response.ContentType = "application/json";
    context.Response.Write(result);
}

Error : Unexpected character encountered while parsing value: s. Path '', line 0, position 0.

How do I fix error ?

This function send;

public static string ApiProcesRequest(string request)
    {
        Result result = new Result();
        try
        {
            var req = JsonConvert.DeserializeObject<Request>(request);
            switch (req.RequestType)
            {
                #region 1002 - Kullanıcı şifre hatırlatma
                case "1002":
                    result = UserProcess.PasswordReminder(request);
                    return JsonConvert.SerializeObject(result);
                    break;
                #endregion } } }

Upvotes: 1

Views: 36971

Answers (1)

Dragon
Dragon

Reputation: 455

string jSon = new StreamReader(context.Request.InputStream).ReadToEnd();

Here you might got the string like s.Path, it can not be deserialize due to it's not a well-formed json object.

Upvotes: 2

Related Questions