Skip to main content

All Questions

Tagged with
0 votes
1 answer
24 views

ASP.NET Core Web API - How to use XML formatter for a single endpoint while keeping JSON for others?

I have an ASP.NET Core Web API that primarily uses JSON for communication. However, I need one specific endpoint to handle XML requests and responses. I've added a custom XmlSerializerOutputFormatter ...
Mateusz's user avatar
  • 11
-1 votes
2 answers
45 views

Deserialising json with JSON.NET , unable to find the right class format [duplicate]

I receive a Json file. Now the other company change the Json and I have to find the right format for my class in C.Net and I'm not able to do so. My Json looks like : { {"xxx": [ "...
baronming's user avatar
  • 248
0 votes
1 answer
33 views

Getting default values using TypeNameHandling in Newtonsoft JSON

I'm doing a basic serialize / deserialize with $type included to implement the outbox pattern. however I'm getting the default values. Here's the code serializing : JsonConvert.SerializeObject(...
Sulabee's user avatar
  • 23
1 vote
0 answers
63 views

How to read a JSON file using StreamReader in C# and skip invalid nodes

I am trying to read and process a large JSON file in C# using StreamReader and JsonTextReader. My goal is to read the JSON file node by node, and if any node contains invalid data (e.g., malformed ...
Savan Gangani's user avatar
0 votes
1 answer
34 views

Service Bus SendMessageAsync failing when ApplicationProperties is set with values from a Json Deserialized Dictionary<string,object>

I have a scenario I need to set ApplicationProperties to a Azure Service Bus message. I have dictionary of key, value type <string,object>. I also use System.Text.Json for deserializing the ...
binga58's user avatar
  • 125
0 votes
0 answers
25 views

How to send HTTP Post request in C# without JSON content [duplicate]

So I need to sent an HTTP Post request in C# (.NET) without JSON parameters because they are already in message.SentUrl (That's just how my boss wants me to do it) and if the response is 200 return ...
Martin Mercado's user avatar
0 votes
1 answer
39 views

How to add custom type conversion for configuration

I have a toml file for configuration where a few sections contain Crontab expressions that I want to be automatically parsed instead of capturing it as a string then parsing it. public record ...
Birdalicious's user avatar
0 votes
2 answers
85 views

Newtonsoft.Json don't support FrozenDictionary. Can I write a converter for it

Newtonsoft.Json don't support FrozenDictionary. I know I can write a JsonConverter starting from scratch, but it is difficult for me, and FrozenDictionary is very similar to a Dictionary when ...
sybil's user avatar
  • 81
2 votes
0 answers
66 views

Manipulating JsonPatchDocument -> identifiers to id

We are implementing patch in .net 7, using JsonPatchDocument and want to add a product to a task. Problem is we are not using database id's in the frontend, but identifiers. Without identifiers, we ...
Michael Winther's user avatar
0 votes
2 answers
69 views

How to serialize the recursive dictionary in C#?

Below class is the recursive dictionary (tree-like structure). The EntityID is just the alias of string which must be accessed via HierarchicalRelationshipsMap.EntityID. public class ...
Takeshi Tokugawa YD's user avatar
0 votes
1 answer
47 views

How to correctly create a String which, After Deserialization can be used to fetch Properties of a Dynamic Object via index

I have a method that desterilizes a string to a Dynamic object, and then accesses it's properties via Index. This is a Customer written code that can not be changed. public void CustomerMethod(string ...
Bluemarble's user avatar
  • 2,029
0 votes
1 answer
89 views

Cannot deserialize json in list of .net object

I would like to know if there is a possibility to deserialize the first node items in the List items in the conditions.cs. When I am trying to deserialize that, I have a conditions object with all the ...
guiz's user avatar
  • 155
1 vote
1 answer
47 views

How to groupby JArray and show the max?

I have a JArray as below: [ { "group_pid": 1, "dataPool": 25000 }, { "group_pid": 0, "dataPool": 18750 }, { "group_pid": ...
Donald's user avatar
  • 613
0 votes
1 answer
110 views

During deserialization using System.Text.Json, I get an error "Each parameter in the deserialization constructor must bind to an object property"

I am developing an ASP.NET Core project and I am trying to deserialize JSON data using System.Text.Json. However, I am getting the following error: Each parameter in the deserialization constructor ...
Rabia's user avatar
  • 3
0 votes
2 answers
81 views

How to get access the last item of a JSON array using Newtonsoft.Json SelectToken method

Is there a way to get the last item of a JSON array using a JSON query only (in this case Newtonsoft.Json SelectToken method)? I can not use the Last method from Newtonsoft.Json, as I get the query ...
AmirHosseinMp02's user avatar

15 30 50 per page
1
2 3 4 5
246