All Questions
Tagged with newtonsoft or json.net
14,095 questions
0
votes
1
answer
100
views
Unity crashes after I run my save file script
I'm trying to create a save file that save the position and speed of all objects in the scene, however when OnSave() is called, the unity editor completely freezes and doesn't seem to do anything.
...
Best practices
1
vote
9
replies
148
views
How to load multiple API responses in one object
I need to load a series of API responses into one object because the item limit in the API is less than the total items. Currently I'm reading the response into a json string and reurning it once.
...
Best practices
0
votes
0
replies
48
views
How to convert JSON text to a JToken with exact values of both doubles and decimals?
I need to convert serialized JSON text to a JToken jt in a way that preserves exact values of doubles _and_ of decimals: Values serialized from double.MaxValue, decimal.MinValue, double.Epsilon and ...
3
votes
1
answer
137
views
Serialize and deserialize property with dynamically assigned property name based on a type given in an attribute [duplicate]
I'm using newtonsoft.json.
I've got classes created from XSD to C#.
Inside these classes are some properties whose names should dynamically change when serializing in XML, based on the type to as ...
7
votes
2
answers
283
views
JSON Deserialization of Custom HashSet
I'm using a C# Library that implement a custom HashSet<T> called ObservableHashSet<T>. You can find more information about it here. And here the source code for the ObservableHashSet
Short ...
5
votes
1
answer
175
views
How do I prevent JSON deserializer converting a date value in a DataSet when the first row is NULL
I am aware of the issue when deserialising date values in JSON strings that represent a System.DataSet when the first row contains a NULL.
Compare the two strings:
"{\"Table1\":[{\"...
1
vote
1
answer
256
views
Using "System.Text.Json.JsonSerializer" to generate OpenAPI source code
I am binding an OpenAPI 3.0 JSON file in my C# project with .NET Framework 4.8.
While doing this, I want to adjust the .json configuration to make the code generated using OpenAPI code generator use ...
2
votes
1
answer
153
views
Newtonsoft for ISerializable classes with a reference loop - use GetObjectData for serialization and ordinary constructor for deserialization
I have a couple of ISerializable classes (simplified):
internal interface IBase : ISerializable
{
int Number { get; }
}
internal interface ITable : IBase
{
ISection Section { get; }
}
[...
3
votes
1
answer
179
views
Deserialization via Newtonsoft for classes with a reference loop, private constructors and private/internal properties setters
I have a couple of classes (simplified):
internal interface ITable
{
int Number { get; }
ISection Section { get; }
}
internal class Table : ITable
{
public int Number { get; private init; ...
0
votes
0
answers
88
views
How to specify a field of default value to be always included individually in yaml definition for a C# OpenAPI service
I have a C# OpenAPI service, which uses dotnet-nswag.dll openapi2cscontroller to generate the Controller code based on a yaml definition.
In Program.cs,
builder.Services.AddNewstonsoftJson(
...
0
votes
1
answer
107
views
Json Serialization - Work around for ExpandableObjectConverter [duplicate]
I'm writing code for .NET 8.
Given this class Sample:
[Serializable]
[TypeConverter(typeof(ExpandableObjectConverter))]
[DataContract]
public class Sample
{
[DataMember]
public int SampleId {...
1
vote
1
answer
94
views
Coding a Nested JSON object using Newtonsoft.Json
I am attempting to code a nested JSON object for an upload API endpoint. I am having issues forming the code for the nested object. When I call the endpoint to post the data to their site, I get a ...
0
votes
1
answer
149
views
Deserializing array of objects to concrete .NET types using Newtonsoft
I have a couple of classes (simplified):
internal class OrderItem
{
public string Name { get; set; }
public Order Order { get; set; }
}
internal class Order
{
public IReadOnlyList<...
0
votes
0
answers
79
views
Resolving conflicts between attributes and relationships in JsonApiSerializer
I'm working on a C# program that will integrate with Planning Center's JSON:API-compliant API (the documentation can be found here). For (de)serialization purposes, I'm using the JsonApiSerializer ...
0
votes
1
answer
129
views
Serializing and deserializing inherited class
So i have WeaponStats class that contains one of classes that inherit from IDamageType.
Fire is empty bacause i didn't receive anything back from game designer and its still empty. But i can add ...