我在解析 json 时遇到问题。
json数据在这里:http ://beta.fmeserver.com/fmerest/engines/.json?token=0ccfa0400b2d760fa3519baf18a557edb118356e 。
我用json2csharp创建了一些类,但搜索为空:
var url = "http://beta.fmeserver.com/fmerest/engines/.json?token=0ccfa0400b2d760fa3519baf18a557edb118356e";
WebClient client = new WebClient();
var json = client.DownloadString(url);
var search = JsonConvert.DeserializeObject<ServiceResponse>(json);
public class Engine
{
public int FMEBuildNumber { get; set; }
public string FMEHostName { get; set; }
public string FMEInstanceName { get; set; }
public int currentJobID { get; set; }
public int maxTransactionResultFailure { get; set; }
public int maxTransactionResultSuccess { get; set; }
public int resultFailureCount { get; set; }
public int resultSuccessCount { get; set; }
public int transactionPort { get; set; }
}
public class Engines
{
public List<Engine> engine { get; set; }
}
public class ServiceResponse
{
public string requestURI { get; set; }
public string token { get; set; }
public Engines engines { get; set; }
}
[JsonObject(MemberSerialization.OptIn)]
public class RootObject
{
[JsonProperty("serviceResponse")]
public ServiceResponse ServiceResponse { get; set; }
}