Skip to main content

All Questions

Tagged with
0 votes
0 answers
4 views

How to call ReadJsonAsync() from static class to another public class

I have a static helper class which reads the Json File, which I need to class inside another public class Code Snippet Helper.cs: public static class Helper { public static async Task Main(string[] ...
Jeevitha's user avatar
  • 119
0 votes
1 answer
20 views

Why the `Items` property within `Newtonsoft.Json.Schema` is represented as a `IList<JSchema>`?

According to the documentation of JSON Schema, the value of "items" MUST be a valid JSON Schema itself for the subschema, while within the Newtonsoft.Json.Schema package, Items are ...
W.S.'s user avatar
  • 1,473
0 votes
1 answer
33 views

Cannot apply indexing with [] to an expression of type object

I'm working on API on the .NET Windows form. I copied the code from the website provided and I found an error say: Cannot apply indexing with [] to an expression of type 'object' How to fix this? ...
waleed's user avatar
  • 55
1 vote
0 answers
34 views

How do I move a type to a dependent assembly without breaking deserialzation of existing data?

I have a .Net framework project that contains two different concerns: ( This is a cut down illustration of the real problem space ) CompanyName.ProjectName /consumers /DTOs I want to split out ...
Eterm's user avatar
  • 1,798
1 vote
1 answer
39 views

How to write the string representation of a class efficiently using Json.Net?

Suppose I have a class with a ToString function. I can easily customize json.net serialization so that the class is written as the string returned by ToString. That is easy. But I do not like the idea ...
mark's user avatar
  • 61.8k
1 vote
1 answer
80 views

Netwonsoft JsonConvert.Deserialization Throws JsonSerializationException: 'Error converting value "My Custom Object's Name" to type 'System.Type'

I recently joined a new team at work and have been having some trouble setting up the repository for one of our applications, specifically I recieve an error when I try to perform an operation, and we ...
Jacob Thomas's user avatar
1 vote
1 answer
161 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
58 views

How to test deserialization in calls to Contentful's GetEntries?

I am adding a new content model in Contentful, and I'm using Contentful's .NET SDK to retrieve its entries. In the past I've experienced problems migrating from Newtonsoft.Json to System.Text.Json, ...
RAM's user avatar
  • 2,659
0 votes
1 answer
50 views

How to identify location of invalid JSON in Newtonsoft.Json

I struggled in debug, for longer than I would care to admit, over an invalid enumeration value in a JSON string when deserializing an object. I wonder if there is a method or switch for exposing the ...
Hamilton Woods's user avatar
2 votes
1 answer
227 views

.NET Serializing a complex Dto to JSON string

I am working with a Dto Structure that looks like the following. I will omit information regarding other derived types as they are not part of the problem at hand. Take note that the OldValue and ...
R K's user avatar
  • 33
0 votes
1 answer
62 views

Raylib_cs terminates after loading font to static member

I'm trying to load a font into an object that is a member of a static class in the C# binding of Raylib. My objective is to use a single static class accessible from across my entire project using a ...
Boyfinn's user avatar
  • 309
0 votes
0 answers
56 views

How to parse large json file in c# to avoid Out of memory exception

I have json file stored in text file which is of size 40 GB+.I am using below code which is throwing Out of memory exception. Is there any way we can take part by part of text file and parse ,...
peter's user avatar
  • 8,602
0 votes
2 answers
103 views

Using Newtonsoft.Json to serialize / deserialize an interface

Given the interface and the class below public interface IFoo { string Name { get; set; } } public class Foo : IFoo { public string Name { get; set; } = "name"; public string ...
McLovin's user avatar
  • 3,408
1 vote
1 answer
51 views

C# Custom Dictionary with JSON (de-)serialize

I have to create a C# class for a dynamic JSON I get from an external API. The json looks like this: { "id": "dataset0", "properties": { "createtime&...
Micha's user avatar
  • 13
0 votes
1 answer
144 views

Get count of column based on condition inside JSON

Requirement is to get count of column based on condition inside JSON string string jsonString = """{"data":"key = IAfpK, age = 58, key = WNVdi, age = 64"}""...
Dave's user avatar
  • 15

15 30 50 per page
1
2 3 4 5
104