-5

I am facing this problem to convert this JSON File. Anybody please tell me how to deserialize this JSON file. https://fasp-ee999.firebaseio.com/Students.json?auth=yB71DWGpZeBBQjvtEvc4yeROXO8zp717W180rlzw

Above is my json file

Itachi Uchiha
  • 307
  • 4
  • 9

1 Answers1

1

It looks like a dictionary, sample with .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);
        }
    }
}
Peter
  • 111
  • 4
  • Bro, you helped me a lot. Thank you so much much but. I want to print those JSON objects how do I do. if I use for each statement and student.value then I am not getting the objects correctly. please help me in this situation also, please – Itachi Uchiha Sep 06 '20 at 03:00
  • Bro I want to download a string from the internet then I want to deserialize how can I do this – Itachi Uchiha Sep 06 '20 at 03:06
  • 1
    @InfiniteCoders: [Download from Internet](https://stackoverflow.com/questions/10928528/receiving-json-data-back-from-http-request/10928807), [Print a dictionary](https://stackoverflow.com/questions/28552603/c-sharp-print-dictionary) – Peter Sep 06 '20 at 13:36