I have an API Rest method which returns this object:
<code> return new ApiResult
{
Success = true,
Data = new
{
profile = usuario.Data,
workerId = trabajador.TrabajadorId
}
}
</code>
<code> return new ApiResult
{
Success = true,
Data = new
{
profile = usuario.Data,
workerId = trabajador.TrabajadorId
}
}
</code>
return new ApiResult
{
Success = true,
Data = new
{
profile = usuario.Data,
workerId = trabajador.TrabajadorId
}
}
where usuario.Data
is other object of type ProfileInfo
.
When I receive that object in the client, profile
property is a JSON object with just 1 property called ValueKind
.
I have added this in Program.cs
file:
<code>builder.Services
.AddRazorPages()
.AddNewtonsoftJson(options => {
options.SerializerSettings.ReferenceLoopHandling =
ReferenceLoopHandling.Ignore;
});
</code>
<code>builder.Services
.AddRazorPages()
.AddNewtonsoftJson(options => {
options.SerializerSettings.ReferenceLoopHandling =
ReferenceLoopHandling.Ignore;
});
</code>
builder.Services
.AddRazorPages()
.AddNewtonsoftJson(options => {
options.SerializerSettings.ReferenceLoopHandling =
ReferenceLoopHandling.Ignore;
});
to change system.Text.Json to Newtonsoft instead, but the problem persists.
any help?