CSharp · Console
using System;
using Newtonsoft.Json;
using System.Linq;
using Newtonsoft.Json.Linq;
namespace ConsoleApp1
{
public class Program
{
public class Cliente
{
public string Idade { get; set; }
public string Telefone { get; set; }
public string Nome { get; set; }
}
public static void Main(string[] args)
{
var text = "{\"-L1OD7LjENM8ZHSpS7NE\":{\"Idade\":\"18 anos\",\"Nome\":\"vitor\",\"Telefone\":\"11 970705570\"},\"-L1ODHPKmz_1zcCfpZwF\":{\"Idade\":\"10 anos\",\"Nome\":\"joao \",\"Telefone\":\"9898294792\"},\"-L1ODMFC92yisdG4UxPU\":{\"Idade\":\"30 anos\",\"Nome\":\"bruno\",\"Telefone\":\"9898294792\"}}";
var listaDinamica = JsonConvert.DeserializeObject<JToken>(text);
var lista = listaDinamica.Select(x => ((JProperty)x).Value.ToObject<Cliente>()).ToList();
foreach (var item in lista)
{
Console.WriteLine(item.Nome);
}
}
}
}