All Questions
3,662
questions
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
{
...
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,
};
...
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 ...
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/...
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 = &...
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:
"{\&...
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:\...
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 ...
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 ...
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,
"...
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 ...
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 ...
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 ...
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 ...
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....