Click here to Skip to main content
15,067,539 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi,i added webservice in xamarin form project, and after send request i got the result in object but when i added code to serialaize and deserialaize object i got error,
how can i read result of request ?

What I have tried:

C#
var servico = new de.xxxx.wsm.WebService();
object Obj = servico.WsmPersCur(new WsmPersCur_Input()
            {
                DeviceNo = "0000000000000000",
                Search = name,


            });

    string jsonString = JsonSerializer.Serialize(Obj);
     var serialaizer = new JsonSerializer();
     var jsonresult = JsonConvert.DeserializeObject(Person).tostring();
     var result = JsonConvert.DeserializeObject<Person>(jsonresult);
Posted
Updated 13-Oct-21 4:25am

1 solution

If you're using Newtonsoft.Json, as the JsonConvert reference suggests, there is no static Serialize method on the JsonSerializer class. You would have to create an instance, and then call one of the instance Serialize methods, all of which require at least two parameters.

Alternatively, you could use the JsonConvert.SerializeObject static method, which only requires one parameter.

If you're using System.Text.Json, there is a static Serialize method. But again, all of the overloads require at least two parameters.
   

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