c#导入Newtonsoft.Json使用Newtonsoft.Json;解析没有key值的数组
1.首先导入Newtonsoft.Json;右键点击项目管理NuGet包点击-浏览-搜索Newtonsoft.Json下载即可,命名空间应用引用using  Newtonsoft.Json;
using Newtonsoft.Json.Linq;c#导入Newtonsoft.Json使用Newtonsoft.Json;解析没有key值的数组

using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

string path = @"E:/life-expectancy-table.json";
            using (System.IO.StreamReader file=System.IO.File.OpenText(path))
            {
                using (JsonTextReader reader = new JsonTextReader(file))
                {
                   // JObject o = (JObject) JToken.ReadFrom(reader);
                    JArray ja = (JArray) JToken.ReadFrom(reader);
                    for (int i = 0; i < ja.Count; i++)
                    {
                        // Console.WriteLine(ja[i][0]);
                         Console.WriteLine(ja[i][3]);
                    }
                }
            }

相关文章:

  • 2022-12-23
  • 2021-12-06
  • 2021-06-01
  • 2022-12-23
  • 2022-12-23
  • 2021-06-04
  • 2022-12-23
猜你喜欢
  • 2021-10-11
  • 2022-12-23
  • 2021-06-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案