Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
1 vote
1 answer
41 views

ASP.NET Core 6 Web API : use queryString on complex json can not bind successfully

When I use the GET API to send a complex JSON format, the backend cannot obtain the data correctly. This my query string data: { "page": 1, "page_size": 10, "...
Lan Lin's user avatar
  • 15
1 vote
1 answer
122 views

.NET 6 - Type Agnostic Json Serialization with camelCase through PropertyNamingPolicy

I need a way to read json config via an asp.net 6 backend and send it to frontend in json format with camelCase property names. The original json config uses PascalCasing for its property names. The ...
BasiK's user avatar
  • 558
1 vote
1 answer
253 views

How to ignore empty strings in API JSON response?

I have an API developed in .NET6. Currently, all properties that are being returned as null, are being hidden via the below: _ = services.AddControllers().AddJsonOptions(options => { options....
Clive Cauchi's user avatar
1 vote
1 answer
253 views

Deserialize JSON from request body with dynamic keys

I have a Rest API that accepts a JSON model consisting of its fields are dynamic GUIDs. I tried multiple models and in all of them, I got an error. This is the JSON: { "meta_data": { ...
Dvir Naim's user avatar
  • 109
0 votes
0 answers
108 views

Refit.ApiException at System.Text.Json.Serialization.JsonCollectionConverter

I am using Refit to call APIs in .NET 7.0 System.Text.Json.Serialization.JsonCollectionConverter throws exception when the response returned in empty. It works fine when result contains data. I think ...
Hakuna's user avatar
  • 425
0 votes
2 answers
106 views

.NET 6 Service: how to pass JSON inside JSON?

I am developing a .NET 6 web service (with Startup), one of methods is public async Task<ActionResult> PutDirector([FromBody] Director director, CancellationToken cancellationToken) { var ...
ZedZip's user avatar
  • 6,280
0 votes
1 answer
2k views

Returning Data from ASP.NET Core 6 Web API controller slow performance

We've have an ASP.NET Core 6 Web API project C#, which we originally upgraded from ASP.NET Core 3.1. We are currently having an issue where any APIs with return new JsonResult(data) It is incredibly ...
Liam's user avatar
  • 483
0 votes
1 answer
1k views

System.Text.Json UTF-8 Deserialization confusion

I have a generic JSON file caching service that will take a .NET object and write it as default/typical minified JSON to the disk. While this works nicely, I wanted to try improving this a bit, by ...
user3267755's user avatar
  • 1,060
3 votes
2 answers
2k views

System.Text.Json JsonStringEnumConverter with custom fallback in case of deserialization failures

I have a .NET 6 program that needs to deserialize a JSON string value (returned by external API) into a .NET enum. The issue is that there are over 100 possible enum values (and more could be added ...
scharnyw's user avatar
  • 2,634
0 votes
1 answer
442 views

Deserialize a JSON string received from an online API

I have a JSON feed which I am trying to deserialize: { "d": [ { "__type": "Status:http://jdlf.com.au/ns/business/api", "...
Michael van der Veeke's user avatar
0 votes
1 answer
1k views

How to ignore JsonPropertyName in serialization using System.Text.Json in .Net 6

I am using System.Text.Json in .NET 6 and I have some data classes that have properties annotated with JsonPropertyName to be able to communicate with another API, but now I need to use the original ...
Isu's user avatar
  • 341
1 vote
1 answer
106 views

Idiom for removing a JsonNode?

I am trying to modify an in memory JsonNode instance. Minimal reproducible code is simply (.NET Fiddle): string jsonString = @"{ ""Date"": ""...
malat's user avatar
  • 12.2k
0 votes
1 answer
517 views

JSON serialization with and without private properties

There is a book class with public and private properties: public class Book { private int ID { get; set; } = -1; private string? BaseName { get; set; } = null; public string? Title { get; ...
Angry Fox's user avatar
0 votes
2 answers
167 views

why are properties in my response object set to null?

I have this endpoint method: var authToken = await [url] .AddAuthHeaders(config) .PostJsonAsync(new AuthTokenRequest { ...
dros's user avatar
  • 1,517
0 votes
1 answer
221 views

How to return JSON string as an sub-object in a .NET 6 WebApi controller?

I have the following data structure which I want to return as result from a controller: public class DataModel { public string Id { get; private set; } public string Name { get; private set; }...
Vlad Radu's user avatar
  • 367

15 30 50 per page
1
2 3 4 5 6