using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace ExemploSerializacao
static void Main(string[] args)
Console.WriteLine("Hello World!");
var result = "{\"member\":[{\"href\":\"aquamandev.adp.pt/maximo/oslc/os/zwssr/_U1IvMTAwMDYwNQ--\"}],\"href\":\"aquamandev.adp.pt/maximo/oslc/os/zwssr\",\"responseInfo\":{\"totalPages\":1,\"href\":\"aquamandev.adp.pt/maximo/oslc/os/…\",\"totalCount\":1,\"pagenum\":1}}";
var dataResponse = JsonSerializer.Deserialize<DataResponse>(result);
Console.WriteLine("Serializado");
Console.WriteLine(dataResponse.ToString());
public class DataResponse
[JsonPropertyName("member")]
public List<Member> Members { get; set; }
[JsonPropertyName("href")]
public string Href { get; set; }
[JsonPropertyName("responseInfo")]
public ResponseInfo ResponseInfo { get; set; }
public override string ToString()
var options = new JsonSerializerOptions
return JsonSerializer.Serialize<DataResponse>(this, options);
public class ResponseInfo
[JsonPropertyName("totalPages")]
public int TotalPages { get; set; }
[JsonPropertyName("href")]
public string Href { get; set; }
[JsonPropertyName("totalCount")]
public int TotalCount { get; set; }
[JsonPropertyName("pagenum")]
public int PageNum { get; set; }
[JsonPropertyName("href")]
public string Href { get; set; }