我有一些屬性一類,我還需要轉換成類對象,但問題是,我的JSON字符串字段是每一個時間差,我進入了一個映射字符串,這可怎麼可能。 我的實體類如下所示。如何使用c#中的自定義映射將json字符串解析爲類對象?
public class CustomImportProducts
{
public string Title { get; set; }
public string BarCode { get; set; }
public string Description { get; set; }
}
我的json字符串看起來每次都像下面的樣子。
[{"name":"Bottle","code":"105","note":"empty"}]
// like this and need to map name to title, code to barcode like this
顯示我輸入一個字符串映射從用戶映射象下面這樣:
{"title":"name","barcode":"code","description":"note"}
//this mapping string changes based on requirement.
這樣的鏈接,但它在迅速不是在C#。 當我的JSON字符串像下面
[{"productTitle":"Bottle","Productcode":"105","note":"empty"}]
我的映射字符串,如:
{"title":"productTitle","barcode":"Productcode","description":"note"}
這如何可能的任何想法。 由於事先
提供這種類型的解決方案的任何庫。
@布賴恩·羅傑斯,這是不重複我知道JsonProperty,但我有不同的屬性與類屬性使用確定了價值與價值我已經給了例子也結合了一些映射參數綁定談論每一次不同的數據。 – tthewolf3D