вырезать слово с стринга
есть
string text = "{\"phone\":\"995555303481\",\"message\":{\"successful\":true,\"code\":0,\"errorText\":\"\",\"response\":0}}";
как вырезать отсюда номер 995555303481
Ответы (1 шт):
Автор решения: aepot
→ Ссылка
Как сериализировать и десериализировать JSON в .NET
using System.Text.Json;
public class Response
{
public string Phone { get; set; }
}
var options = new JsonSerializerOptions { PropertyNameCaseInsensitive = true };
string phone = JsonSerializer.Deserealize<Response>(text, options).Phone;