问题使用Newtonsoft-C# - .Net反序列化Json属性,前面是'#'

时间:2018-02-22 21:14:18

标签: c# json

我使用JsonConvert.DeserializeObject()成功地反序列化了Json文件但是我遇到了一个带有很多结构的相当大的json文件的麻烦。问题出在Stats子类中,它们都有一个以@开头的类别和缩写,以及一个以#开头的文本属性。这些值都是空的。

这是类结构

/bin/ls

以下是json的示例     {

using System;
using System.Collections.Generic;
using System.Text;

namespace SalaryCapData.ConsumeJson.Models.Daily
{

        public class Rootobject
        {
            public Dailyplayerstats dailyplayerstats { get; set; }
        }

        public class Dailyplayerstats
        {
            public string lastUpdatedOn { get; set; }
            public Playerstatsentry[] playerstatsentry { get; set; }
        }

        public class Playerstatsentry
        {
            public Player player { get; set; }
            public Team team { get; set; }
            public Stats stats { get; set; }
        }

        public class Player
        {
            public string ID { get; set; }
            public string LastName { get; set; }
            public string FirstName { get; set; }
            public string JerseyNumber { get; set; }
            public string Position { get; set; }
        }

        public class Team
        {
            public string ID { get; set; }
            public string City { get; set; }
            public string Name { get; set; }
            public string Abbreviation { get; set; }
        }

        public class Stats
        {
            public Atbats AtBats { get; set; }
            public Runs Runs { get; set; }
            public Hits Hits { get; set; }
            public Secondbasehits SecondBaseHits { get; set; }
            public Thirdbasehits ThirdBaseHits { get; set; }
            public Homeruns Homeruns { get; set; }
            public Earnedruns EarnedRuns { get; set; }
            public Unearnedruns UnearnedRuns { get; set; }
  .....
        public class Atbats
        {
            public string category { get; set; }
            public string abbreviation { get; set; }
            public string #text { get; set; }
        }

        public class Runs
        {
            public string category { get; set; }
            public string abbreviation { get; set; }
            public string text { get; set; }
        }

        public class Hits
        {
            public string category { get; set; }
            public string abbreviation { get; set; }
            public string text { get; set; }
        }

        public class Secondbasehits
        {
            public string category { get; set; }
            public string abbreviation { get; set; }
            public string text { get; set; }
        }


}

yadda,yadda,yadda。

不确定'text'属性是否缩减为null但是注意'#'?有什么想法吗?

0 个答案:

没有答案