Skip to main content

All Questions

Tagged with
1 vote
1 answer
35 views

Json.Net How to Serialize and Deserialize custom types in custom way

I use the R3 reactive programming library and Newtonsoft. I'm trying to save object data to a file so that I can later read from it. The recording just works without problems. But when reading the ...
Maers's user avatar
  • 13
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
43 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
1 vote
1 answer
79 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
1 vote
2 answers
87 views

Filtering using Newtonsoft with multiple conditions in C#

I'm trying to extract values ​​from json using Newtonsoft, but I'm having some problems. Below is the json snippet I use: { "result": { "areas": [ { ...
BezqyczekPL's user avatar
0 votes
2 answers
87 views

Parse only some attributes of a JSON file in c# using the Newtonsoft Json.NET library

Good day, I am new to JSON handling and have encountered an issue I can't resolve, despite checking the Newtonsoft documentation. I hope you can help me out. I have a JSON file downloaded locally (@&...
Laurent's user avatar
  • 721
0 votes
1 answer
53 views

Treating {} as null when deserializing json objects using custom JsonConverter

Note: re: related questions - they have similar titles but their titles are misleading: reading them reveals they're about a different situation, they're worried about INCOMING null, whereas I need a ...
Adam's user avatar
  • 33.1k
-2 votes
1 answer
74 views

Deserialize JSON(not in an array) with C# and write to a SQL table [duplicate]

Would like some help in parsing the JSON and insert (or at least output the key value pairs) without a specific class/object. JSON string (portion): { "message": "Success", "...
user7481254's user avatar
1 vote
0 answers
31 views

Json object deserialization problem - property can have nested json object, but the serializer throws an exception [duplicate]

(.NET Framework 4.7.2) I am querying data from a web API and using the Newtonsoft JSON package for deserialization. The API returns an array of time/value pairs. My code works when the 'value' is ...
ErikJL's user avatar
  • 121
2 votes
1 answer
143 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
2 answers
171 views

Reading Json number as a string

What I need: Deserialize Json string to and object Do some stuff return it as a string at the end What is the problem? When Json has property like {"foobar" : 0.0000000000000000001}, it is ...
MatteoDelOmbra's user avatar
-1 votes
1 answer
61 views

Is it posible to deserialize JSON to a generics object in C# and have the property name be dynamic?

Updated: Either of the two comments at time of update or the accepted answer are functional solutions, however at the scale being applied introduce more risk and complexity than they would save. ...
Owen's user avatar
  • 3
5 votes
1 answer
95 views

C# Json Deserialize Dynamic Type

We have a C# Console Application that calls several 3rd party API's. We get the data from these API's back in JSON format. We are trying to deserialize the JSON into a defined class. The issue is that ...
BryceBy's user avatar
  • 299

15 30 50 per page
1
2 3 4 5
490