[ASK] c# Xamarin JSOn
String a = "{"success":1,"message":"successfully created."}";
string b = "{"success":1,"message":"successfully created."}";
如何在JSON中获得值成功和消息?
给定(via http://jsonutils.com):)的类模型
public class Example
{
public int success { get; set; }
public string message { get; set; }
}
用法:
var a = "{"success":1,"message":"successfully created."}";
var example = JsonConvert.DeserializeObject<Example>(a);
Console.WriteLine($"{example.success} : {example.message}");
输出:1 : successfully created.