{
"success": 1,
"result": {
"total": 3,
"limit": 0,
"offset": null,
"stocks": [
{
"номенклатураGUID": "GUID",
"складGUID": "GUID",
"назначениеGUID": "GUID",
"остаток": 1,
"rn": 1
},
{
"номенклатураGUID": "GUID",
"складGUID": "GUID",
"назначениеGUID": "GUID",
"остаток": 65,
"rn": 2
},
{
"номенклатураGUID": "GUID",
"складGUID": "GUID",
"назначениеGUID": "GUID",
"остаток": 13,
"rn": 3
}
]
}
}
[DataContract]
public class Remains
{
[DataMember(Name = "success")]
public int Success { get; set; }
[DataMember(Name = "result")]
public Result Result { get; set; }
}
[DataContract]
public class Result
{
[DataMember(Name = "total")]
public int Total { get; set; }
[DataMember(Name = "limit")]
public int Limit { get; set; }
[DataMember(Name = "offset")]
public object Offset { get; set; }
[DataMember(Name = "stocks")]
public Stocks Stocks { get; set; }
}
[DataContract]
public class Stocks
{
[DataMember(Name = "номенклатураGUID")]
public string NomenclatureGuid { get; set; }
[DataMember(Name = "складGUID")]
public string WarehouseGuid { get; set; }
[DataMember(Name = "назначениеGUID")]
public string AppointmentGuid { get; set; }
[DataMember(Name = "остаток")]
public string TotalQuantity { get; set; }
[DataMember(Name = "rn")]
public int Rn { get; set; }
}
var result = JsonConvert.DeserializeObject<Result>(response);
#r "nuget:Newtonsoft.Json/13.0.1"
using Newtonsoft.Json;
var json = @"
{
""success"": 1,
""result"": {
""total"": 3,
""limit"": 0,
""offset"": null,
""stocks"": [
{
""номенклатураGUID"": ""GUID"",
""складGUID"": ""GUID"",
""назначениеGUID"": ""GUID"",
""остаток"": 1,
""rn"": 1
},
{
""номенклатураGUID"": ""GUID"",
""складGUID"": ""GUID"",
""назначениеGUID"": ""GUID"",
""остаток"": 65,
""rn"": 2
},
{
""номенклатураGUID"": ""GUID"",
""складGUID"": ""GUID"",
""назначениеGUID"": ""GUID"",
""остаток"": 13,
""rn"": 3
}
]
}
}
";
// Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse);
public class Stock
{
[JsonProperty("номенклатураGUID")]
public string НоменклатураGUID { get; set; }
[JsonProperty("складGUID")]
public string СкладGUID { get; set; }
[JsonProperty("назначениеGUID")]
public string НазначениеGUID { get; set; }
[JsonProperty("остаток")]
public int Остаток { get; set; }
[JsonProperty("rn")]
public int Rn { get; set; }
}
public class Result
{
[JsonProperty("total")]
public int Total { get; set; }
[JsonProperty("limit")]
public int Limit { get; set; }
[JsonProperty("offset")]
public object Offset { get; set; }
[JsonProperty("stocks")]
public List<Stock> Stocks { get; set; } //Вот тут у вас просто Stock
}
public class Root
{
[JsonProperty("success")]
public int Success { get; set; }
[JsonProperty("result")]
public Result Result { get; set; }
}
var result = JsonConvert.DeserializeObject<Root>(json);