如何反序列化此JSON文件

问题描述

我在转换此JSON文件时遇到此问题。有人请告诉我如何反序列化此JSON文件。 https://fasp-ee999.firebaseio.com/Students.json?auth=yB71DWGpZeBBQjvtEvc4yeROXO8zp717W180rlzw

上面是我的json文件

解决方法

它看起来像字典,带有.net core 3.1的示例:

using System.Collections.Generic;
using System.IO;
using System.Text.Json;

namespace ConsoleApp1
{
    public class Data
    {
        public int id { get; set; }
        public string name { get; set; }
    }

    class Program
    {
        public static void Main(string[] args)
        {
            var dataToDeserialize = File.ReadAllText("Students.json");

            var deserializedResult = JsonSerializer.Deserialize<Dictionary<string,Data>>(dataToDeserialize);
        }
    }
}

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...