Skip to main content

Questions tagged [json.net]

Json.NET (also known as Newtonsoft.Json) is a popular high-performance JSON framework for .NET.

0 votes
0 answers
10 views

Serialize class components as direct part of class?

I was wondering if there was a way to serialize and deserialize a class so that a component is treated as part of that class. public partial class LevelObjectConfig : ObservableObject { [...
Shadowblitz16's user avatar
0 votes
0 answers
31 views

dotnet build "Could not resolve this reference. Could not locate the assembly" error but only occurs on CI?

I have a simple CI that builds my solution on GitLab. The project consist of a .NET Core project and a WCF project. I am encountering an error after installing the latest version of Newtonsoft JSON ...
jdistro07's user avatar
  • 165
0 votes
1 answer
31 views

Read json dictionary with multiple sub keys into unity c# script

I am trying to get my data from a json file into unity with a c# script. The goal is to move all players at the same time based on positional data, which i already have. I need to group the ...
Vintertid's user avatar
0 votes
1 answer
22 views

JToken.FromObject adds square brackets for child

Private Sub btnTest_Click(sender As Object, e As EventArgs) Handles btnTest.Click Dim dtTICKET As New DataTable dtTICKET.Columns.Add("Title", GetType(String)) dtTICKET.Columns....
AndreasA's user avatar
0 votes
0 answers
53 views

Serializer not returning expected output in .NET Core

I have a controller which returns Task<ActionResult> which internally returns a List<CustomObjectA>. The structure of CustomObjectA is like this: [DataContract] public class CustomObjectA {...
Sarthak Agrawal's user avatar
0 votes
2 answers
43 views

How to extract string content of JObject as is?

Look at this code Dim jsonString As String = "{ ""uuid"": ""4b84ca0c-40c8-4c2e-b1af-ddd727f3d0cf"", ""side"": ""bid&...
user4951's user avatar
  • 32.8k
0 votes
1 answer
42 views

cannot convert from 'string' to 'Newtonsoft.Json.JsonReader'CS1503 error showing up how to i convert to newtonsoft.Json.JsonReader?

I was trying to retrive information from a json file and save it to mapCollision and layers but CS1503 error showing up the json file includes 2 jagged arrays which represent a map { "layer&...
Tilak Rao's user avatar
0 votes
1 answer
52 views

How to configure Newtonsoft JSON.NET serializer settings for Swagger example classes?

I am using Newtonsoft JSON.NET for object serialization in an ASP.NET Core (.NET 8) project implementing REST APIs and I need to change serialization settings used for Swagger examples from ...
Alek Davis's user avatar
  • 10.7k
0 votes
0 answers
29 views

System.Text.Json ecapes single quotes by design [duplicate]

I know that System.Text.Json escapes single quotes by design, but the examples for how to allow certain characters to not be escaped from MS Docs doesn't work for me as I want to keep single quotes in ...
Oliver Nilsen's user avatar
1 vote
1 answer
75 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
49 views

Dynamically set the Property name to be the name of the Type(typeof(T).Name)

var appsettings = JsonConvert.DeserializeObject<AppSettings<PersonModel>>(configData); class AppSettings<T> { [JsonProperty(PropertyName = typeof(T).Name)] public T ...
Imran K's user avatar
  • 15
0 votes
0 answers
66 views

In C#, why does System.Text.Json.JsonSerializer.Serialize fail to serialize correctly when using dependency injection (interfaces)? [duplicate]

Why does the following write out only "{}"? var myLogin = new TestLogin { UserName = "[email protected]", Password = "Pass123" }; Console.WriteLine(System.Text.Json....
csharpforevermore's user avatar
0 votes
0 answers
40 views

Ban entire namespace with BannedApiAnalyzers

I am trying to ban the usage of Newtonsoft.Json package in my codebase, and I am trying to use the BannedApiAnalyzers Nuget package (latest stable version, 3.3.4). My problem is that while I am able ...
Gil's user avatar
  • 147
4 votes
2 answers
115 views

How to compute byte size of list<T> in C#

I want to send a large list of objects to another web service for intake. The web service has a byte limit of 6Mb. I want to send my list of 7,000+ objects in 5Mb "batches." To do this, I ...
WorkJ's user avatar
  • 161
0 votes
1 answer
75 views

Newtonsoft: How to find self-referencing loop?

I'm getting an error when I attempt to serialize an object: Self referencing loop detected with type 'Namespace.MyClass'. Path ''. I understand what this error means. Somewhere in my class, I have a ...
ewok's user avatar
  • 21k

15 30 50 per page
1
2 3 4 5
922