json文件
{
"Name":"luck",
"Level":99,
"Age":18,
"SkillList":[
{"id":1,"name":"天下无双","damage":123},
{"id":2,"name":"天下无贼","damage":13},
{"id":3,"name":"天下无雅","damage":121}
]
}
新建一个player类
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp3
{
class player
{
public string Name { get; set; }
/// <summary>
/// 等级
/// </summary>
public int Level { get; set; }
public int Age { get; set; }
public List<Skill> SkillList { get; set; }
public override string ToString()
{
return string.Format("Name:{0},Level:{1},Age:{2},SkillList:{3}", Name, Level, Age, SkillList);
}
}
}
然后进行对象的调用 将一个对象转化为json
网友评论