string json = @"{ 'Departamento': 'Contabilidad', 'Estado': true, 'Empleados': [ { 'Nombre': 'Juan Escutia', 'Edad': 18, 'Fecha': '2022-01-01' }, { 'Nombre': 'Vicente Suarez', 'Edad': 17, 'Fecha': '2022-02-01' }, { 'Nombre': 'Agustin Melgar', 'Edad': 20, 'Fecha': '2022-03-01' } ] }"; Depa depas = JsonConvert.DeserializeObject<Depa>(json); Console.WriteLine(depas.Departamento); List<Empleados> emp = depas.Empleados.ToList(); foreach (var item in emp) { Console.WriteLine(item.Nombre + " | " + item.Edad); } Console.ReadLine();
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter