"{\"is_success\":true,\"msg\":\"登录成功!\",\"data\":{\"user_id\":\"5\",\"user_name\":\"xiaogang\",\"realname\":\"小刚\",\"is_admin\":\"1\",\"user_pid\":\"0\"}}"
那么这个字符串的类要怎么写呢?
/// <summary>
/// 登陆Json类
/// </summary>
public class Get_LoginJsonClass
{
/// <summary>
/// 返回是否成功
/// </summary>
private string Is_success;
public string is_success
{
get { return Is_success; }
set { Is_success = value; }
}
/// <summary>
/// 接受的信息
/// </summary>
private string Msg;
public string msg
{
get { return Msg; }
set { Msg = value; }
}
/// <summary>
/// 接受到的数据
/// </summary>
private data Data;
public data data
{
get { return Data; }
set { Data = value; }
}
}
/// <summary>
/// 返回的date数据
/// </summary>
public class data
{
/// <summary>
/// 用户Id
/// </summary>
private string User_id;
public string user_id
{
get { return User_id; }
set { User_id = value; }
}
/// <summary>
/// 用户名字
/// </summary>
private string User_name;
public string user_name
{
get { return User_name; }
set { User_name = value; }
}
/// <summary>
/// 真实姓名
/// </summary>
private string Realname;
public string realname
{
get { return Realname; }
set { Realname = value; }
}
/// <summary>
/// 是否为管理员
/// </summary>
private string Is_admin;
public string is_admin
{
get { return Is_admin; }
set { Is_admin = value; }
}
/// <summary>
/// 用户pid
/// </summary>
private string User_pid;
public string user_pid
{
get { return User_pid; }
set { User_pid = value; }
}
}
这样就能正常的解析了。