'How to write commands for File/Json

Below is the code I made but I don't know where to start. I will be grateful for the hint.

I have no idea what i should do next..

I want to make a program that will have a few commands.

  1. Adding a new planet

  2. Planet Removal

  3. Show the List

  4. Save to JSON

  5. displays planet data

     public class MyDate
     {
         public int masa { get; set; }
         public int sredni { get; set; }
    
     }
    
     public class Lad
     {
         public string PlanetName { get; set; }
    
         public MyDate Szczegoly { get; set; }
     }    
     class Program
     {
         static void Main()
         {
             string choice = Console.ReadLine();
             //string choiceup = choice.ToUpper();
             switch (choice)
             {
                 case "Add":
                     Add();
                     return;
                 case "Save":                    
                     break;
                 case "List":
                     LoadList();
                     break;
                 case "Exit":
                     return;
             }
         }       
         public static void Add()
         {           
             Console.WriteLine("Podaj nazwe planety");
             string name = Console.ReadLine();
             Console.WriteLine("Podaj mase");
             int masa = Convert.ToInt16(Console.ReadLine());
             Console.WriteLine("Podaj srednice");
             int sred = Convert.ToInt16(Console.ReadLine());            
             List<Lad> _data = new List<Lad>();
             _data.Add(new Lad()
             {
                 PlanetName = name,                
                Szczegoly = new MyDate
                 {
                     masa = masa,
                     sredni = sred                    
                 }
             });
             var json = System.Text.Json.JsonSerializer.Serialize(_data);
             Console.WriteLine(json);            
             string json2 = JsonConvert.SerializeObject(_data, Formatting.Indented);
             File.AppendAllText(@"tescikkk.json", json2);            
         }
         static List<Lad> LoadList()
         {
             string text = File.ReadAllText(@"tescikkk.json");
             if (string.IsNullOrEmpty(text))
                 return new List<Lad>() { };
             return JsonConvert.DeserializeObject<Lad[]>(text).ToList();
         }
     }
    


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source