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

All Questions

Tagged with
0 votes
2 answers
40 views

Deserialize JSON objects do different class names

I am using System.Text.Json to deserialize objects from an external API call in C#. I have created the classes for the data and is very straight-forward. public class DocumentListRoot { ...
JimboJones's user avatar
1 vote
1 answer
21 views

How to set a JsonSerializerOptions globally for my httpClient.GetFromJsonAsync<T> calls

In my ASP.NET web API I have httpClient which call GetFromJsonAsync: var jsonSerializerOptions = new JsonSerializerOptions { PropertyNameCaseInsensitive = true, }; ...
Nicolas's user avatar
  • 6,404
0 votes
0 answers
17 views

System.Net.Http.Json is not taking Fields into account when serializing or deserializing to JSON [duplicate]

When trying to Serialize a model which has data stored in fields System.Net.Http.Json is outputting an empty JSON Object. It works only when I use property with getters and setters. I tried looking ...
Jai dewani's user avatar
0 votes
0 answers
32 views

Cursor dissapears when usin PostAsync .Net Maui

I am Posting a JSON in .Net Maui to HTTPClient that works correctly the most time. But sometimes it fails. I have RestService class that contains a method called PostJason and my code is inside try/...
hugo vazquez's user avatar
0 votes
2 answers
54 views

Problem with Serializing JSON to CamelCase in C#

I am trying to serialize a JSON string to convert property names to camelCase using the System.Text.Json library. However, I still get the outcome with PascalCase. Here is my code: var stringJson = &...
Krystian's user avatar
0 votes
1 answer
28 views

Serialize string to a json value string

I have a scenario where I need to update a field value within an existing serialized JSON string before deserializing it. Specifically, I have the following: Original Serialized JSON String: "{\&...
H94's user avatar
  • 1
1 vote
1 answer
34 views

System.Text.Json.JsonSerializer does not overwrite existing file fully when using file stream

Consider the following code: internal class Program { static async Task Main(string[] args) { var t = new Thing() { Name = "Some Long Name" }; string path = @"c:\...
rory.ap's user avatar
  • 34.9k
1 vote
1 answer
84 views

C# Newtonsoft JSON Deserialization: Empty list value represented as "{}" instead of "[]", throws exception

We are currently supporting an API integration with a 3rd party that transmits responses via JSON. We are using C# .NET and Newtonsoft JSON (version 13.0.1) to handle serialization of requests and ...
Alex's user avatar
  • 133
0 votes
1 answer
141 views

Use System.Text.Json converters with JsonTypeInfo for AOT

My .NET 8 application is AOT-compiled so it needs to use JsonTypeInfo and cannot use reflection-based serialisation. Now I also want to use the converter feature to store objects differently than in ...
ygoe's user avatar
  • 19.8k
0 votes
1 answer
49 views

De-serialize JSON string into .NET object

I have a JSON string something like below: [ { "movie title": "The Matrix", "release date": "1999-03-31", "movie rating": 8.7, "...
kyeleswarapu's user avatar
0 votes
0 answers
19 views

Custom Roslyn Analyzer for stylecop.json and Custom.ruleset rules

I am currently working on a custom Diagnostic Analyzer with c# and wondered if it is possible to have an Analyzer, that analyzes all rules defined in a stylecop.json and a .ruleset file. Something ...
Ruwiwidi's user avatar
0 votes
0 answers
25 views

Reloading partial view with AJAX

So i have a mesaging system that when a message is sent im currently reloading the whole view to see the new message in the conversation, however, i want to make it so jus the message partial reloads ...
Owen's user avatar
  • 19
0 votes
1 answer
28 views

JSON Patch Not Reflecting Correct ID Values in ASP.NET Core Web API

I am working on an ASP.NET Core Web API where I need to apply JSON Patch operations to update entities. The problem I'm encountering is that after applying the JSON Patch, the laboId and analyseId ...
Nadia akrach's user avatar
0 votes
2 answers
107 views

How to get differences between two nested JSON Objects in C#

I wanna compare two nested JSON objects and get differences between theme like add/remove and change value. I used JsonDiffer but when I remove one of objects from first or middle of an Array, it ...
Atabai Fekri's user avatar
1 vote
1 answer
134 views

Strange behavior decoding JWT Token C# NET 8

I have this strange behavior while decoding a JWT bearer token. As an example take this token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9....
Marco Ortali's user avatar

15 30 50 per page
1
2 3 4 5
245