![](/img/trans.png)
[英]How to Convert a String returned from JSON to Object Dot Notation In C# & JSON.Net
[英]How to pass an object that is a member of another object using JSON string notation?
好吧,我有這節課:
public class TAccount
{
public Account account { set; get; }
public double transactionAmount { set; get; }
}
和這個類:
public class Account
{
public int Id { set; get; }
public string AccountName { set; get; }
public double Balance { set; get; }
public string LastOperation { set; get; }
}
我想發布以下json字符串,但看不到我正在嘗試向TAccount
類內的Account對象添加值
json字串:
{ "TransactionAmount": 98, "Account":[{"Id" : 4 , "LastOperation" : "credit"}]}
任何幫助表示贊賞。
C#類:
public class TAccount
{
public Account account { get; set; }
public double transactionAmount { get; set; }
}
public class Account
{
public int Id { get; set; }
public string AccountName { get; set; }
public double Balance { get; set; }
public string LastOperation { get; set; }
}
嘗試使用以下結構發送:
{
"transactionAmount": 98,
"account": {
"Id": 4,
"LastOperation": "credit"
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.