assuming ServiceSoapClient.Api returns the json string as described its:
string resp = await ServiceSoapClient.Api(myjson);
DeserializedClass.Root? root = JsonSerializer.Deserialize<DeserializedClass.Root>(resp);
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello everyone and thanks for the help in advance. I have a Windows application that posts json to a webservice which in turn returns a json response. I am using a class that looks like:
public class DeserializedClass
{
public class Message
{
[JsonProperty("@xmlns:xsi")]
public string XmlnsXsi { get; set; }
[JsonProperty("@DatatypesVersion")]
public string DatatypesVersion { get; set; }
[JsonProperty("@TransportVersion")]
public string TransportVersion { get; set; }
[JsonProperty("@TransactionDomain")]
public string TransactionDomain { get; set; }
[JsonProperty("@TransactionVersion")]
public string TransactionVersion { get; set; }
[JsonProperty("@StructuresVersion")]
public string StructuresVersion { get; set; }
[JsonProperty("@ECLVersion")]
public string ECLVersion { get; set; }
public Header Header { get; set; }
public Body Body { get; set; }
}
public class Root
{
public Message Message { get; set; }
}
}
I sent the message:
DeserializedClass deserializedClass = new DeserializedClass();
DeserializedClass.Root messageroot = new DeserializedClass.Root();
messageroot.Message = new DeserializedClass.Message
The application returns json in the format:
{"Message":{ etc.
The call to the web service looks like string resp = await ServiceSoapClient.Api(myjson);
However, I cannot figure out how to deserialize the response. Any help would be appreciated.
assuming ServiceSoapClient.Api returns the json string as described its:
string resp = await ServiceSoapClient.Api(myjson);
DeserializedClass.Root? root = JsonSerializer.Deserialize<DeserializedClass.Root>(resp);
a sample of the response json would help