13,887 questions
-1
votes
0
answers
57
views
Why is `JArray.ToObject<List<T>>` faster than `JArray.ToObject<T[]>`
We are trying to micro-optimise some parts of our production code and I was expecting that using Arrays would generally be better than Lists in .NET, and most of the times, my benchmarks indicate that....
-5
votes
0
answers
45
views
How to convert recursive XML to JSON in C#? [closed]
The software I am coding stores test cases in XML, but the size of the xml is quite large so I want to use json to store the test cases. Is there a way to convert recursive xml files to json?
<...
2
votes
2
answers
97
views
Serialize/deserialize a ReferenceLoop of ISerializable objects with Newtonsoft.JSON (Json.NET)
Preamble: I know about ISerializable deprecation. We have to use it because we have massive legacy codebase for IPC (that uses this interface). We are migrating from .NET Remoting to a crossplatform ...
3
votes
1
answer
88
views
How Can I Ignore One Property based on JsonProperty Value of another Property during Deserialization?
I have the following class, how can I ignore the Response, if StatusCode == 400?
If StatusCode is 400, Response is returned in a different format that doesn't match my APIResponse class and throws an ...
1
vote
1
answer
93
views
How to split big JSON schema file into multiple files to use with Newtonsoft JSON.Net
I need to write a JSON schema file for some request/response structures of an API-project, so that I can use them with "Json.NET Schema". Because some of the objects are used in mutiple ...
0
votes
1
answer
28
views
Getting exception during deserialization in PostgreSqlConnection.GetStateData method
I have a .NET 8 service which uses Hangfire library for async jobs. I have configured Hangfire with PostgreSQL database.
I need to check the state of a running job frequently for which I am using the ...
2
votes
0
answers
60
views
Have different property name for deserialization and serialization using Newtonsoft [duplicate]
I have a class with a public property:
public string Service {set; get;}
I know of the JsonProperty attribute which allows me to map the name of the field in both directions of deserialization and ...
-2
votes
1
answer
81
views
Change values in JSON file
I have a JSON file with nested values, I want to change any value in the file (ex: "supplierIdentifier" value is "002264HAM001" want to replace it to "0194711AMM00".
...
-2
votes
2
answers
88
views
Get values inside JSON string
I have this JSON:
{
"result": {
"data": {
"getEstelam3Response": {
"return": {
"birthDate": "13650412",
...
1
vote
1
answer
121
views
Problem with serializing object structure with Newtonsoft Json.NET
I have to serialize a data structure for a 3rd-party interface either to XML or to JSON. The expected result should look like the following (simplified) example:
XML:
<?xml version=\"1.0\"...
0
votes
1
answer
51
views
ASP.NET WEB API change the JSON in response as it is supposed to return
So I am currently building an ASP.NET WEB API with .net5 (I am working as an intern in a company where we only have .net5 apps unfortunately).
To make it short, I have a "Component" table in ...
0
votes
0
answers
35
views
Prevent Newtonsoft deserialising a field, but still allow it to serialise [duplicate]
For the following code (.net fiddle here) I'm coming across a deserialisation issue.
public static void Main()
{
var beef = new Beef()
{
Porks = [
...
2
votes
1
answer
87
views
Update table according with JSON/JSONB
I have a table books :
Name of column
Type
id
int (PK)
name
text
nb_pages
int
And a table book_modifications :
Name of column
Type
id
int (PK)
old_data
jsonb
new_data
jsonb
book_id
int (FK)
Now let's ...
-1
votes
1
answer
69
views
Unexpected end of string while parsing json [duplicate]
I have the following json string:
{
"tables":
[
"%USER%.ABCDE_FAC_FINAL_%YEAR%",
"%USER%.ABCDE_FAC_STAGE_%YEAR%",
"%USER%....
0
votes
1
answer
83
views
I've encountered a problem regarding referencing multiple versions of a DLL
I've encountered a problem regarding referencing multiple versions of a DLL. I've tried various methods to solve it. I'm seeking help.Thanks!
In a program, I referenced the DLL component of version 13....