0
我正在使用Json.Net Libary。並且我無法將JSON對象恢復到我的c#對象中。C#:Json.NET - > Json回到對象
我目前有: JSON
[{"Datum":"31-05-2012","Naam":"KN: xxxx","Prijs":"37","Id":31123,"status":"found","foundPrice":"37.50","betaald":"2012-06-01","ingepakt":"2012-06-03","geanuleerd":"nee","verstuurd":"nee","achternaam":"xxxx","straat":"xxxx 98","postcode":"4422xx","plaats":"xxxxx","land":"Nederland","gewicht":"0.600"},{"Datum":"31-05-2012","Naam":"xxxxT","Prijs":"23","Id":31341,"status":"found","foundPrice":"23.00","betaald":"2012-06-01","ingepakt":"2012-06-03","geanuleerd":"nee","verstuurd":"nee","achternaam":"xxxx","straat":"de xxxxx 2","postcode":"4444xx","plaats":"xxxx","land":"Nederland","gewicht":"0.300"}]
和對象:
public class OrderObject
{
public string Datum, Naam, Prijs;
public int Id;
public string status;
public string foundPrice;
public string betaald;
public string ingepakt;
public string geanuleerd;
public string verstuurd;
public string achternaam;
public string straat;
public string postcode;
public string plaats;
public string land;
public string gewicht;
}
爲了使這些對象的列表,以JSON我只需要:
private void sentToServer(List<OrderObject> input)
{
var inputJson = JsonConvert.SerializeObject(input);
}
但什麼我需要做相反的過程嗎? 任何人都可以幫助我嗎?
THX Matthy
THX很多它的工作我試圖//變種Jspnoutput = JsonConvert.DeserializeObject(輸出);如此接近,但迄今爲止 –
matthy