1
私は次のようにクラスを作成しJSON形式で使用してC#の
{
"attachments": [
{
"fallback": "Required plain-text summary of the attachment.",
"color": "#36a64f",
"pretext": "Pre-text",
"author_name": "Myself",
"author_link": "http://author.link",
"author_icon": "http://author.icon",
"title": "This is my great title",
"title_link": "https://api.slack.com/",
"text": "This is the text field",
"image_url": "http://image.path",
"thumb_url": "http://image.path",
"footer": "News Article",
"footer_icon": "http://image.path",
"ts": 201601010000
}
]
}
のC#.NETを使用して、次のJSONオブジェクトを作成しようとしています:
public class Attachment
{
[JsonProperty("fallback")]
public string FallBack { get; set; }
[JsonProperty("color")]
public string Color { get; set; }
[JsonProperty("pretext")]
public string PreText { get; set; }
[JsonProperty("author_name")]
public string AuthorName { get; set; }
[JsonProperty("author_icon")]
public string AuthorIcon { get; set; }
[JsonProperty("title")]
public string Title { get; set; }
[JsonProperty("title_link")]
public string TitleLink { get; set; }
[JsonProperty("text")]
public string Text { get; set; }
[JsonProperty("image_url")]
public string ImageUrl { get; set; }
[JsonProperty("thumb_url")]
public string ThumbUrl { get; set; }
[JsonProperty("footer")]
public string Footer { get; set; }
[JsonProperty("footer_icon")]
public string FooterIcon { get; set; }
[JsonProperty("ts")]
public long TimeStamp { get; set; }
[JsonProperty("author_link")]
public string AuthorLink { get; set; }
}
をしてJsonConvert.SerializeObjectを使用しようとしました()クラスのプロパティを返すのはこれだけです:
{
"fallback": "Required plain-text summary of the attachment.",
"color": "#36a64f",
"pretext": "Pre-text",
"author_name": "Myself",
"author_link": "http://author.link",
"author_icon": "http://author.icon",
"title": "This is my great title",
"title_link": "https://api.slack.com/",
"text": "This is the text field",
"image_url": "http://image.path",
"thumb_url": "http://image.path",
"footer": "News Article",
"footer_icon": "http://image.path",
"ts": 201601010000
}
"atta最初にチャレスセクション? JSONの初心者です。ウェブメソッドが最初に「添付ファイル」配列を期待しているようです。
'public list添付ファイル{get;セット; } ' –