Skip to main content
0 votes
1 answer
19 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
0 answers
7 views

How to use Newtonsoft JSON serializer for all Flurl 4.0 calls globally or per specific client

I need to use Newtonsoft JSON serializer for all calls made via Flurl 4.0 (or at least for all calls made by a specific Flurl client), but I cannot figure out how to set it up. From the answer to the ...
Alek Davis's user avatar
  • 10.7k
1 vote
1 answer
56 views

c# JsonConvert.SerializeObject is updating the date

I am trying to remove all indentation from my json : "date": { "start": "2020-10-23T15:30:00+00:00" } I tried with this var freeContent = JsonConvert....
Midlo215's user avatar
0 votes
0 answers
19 views

How do I use ValidationAttribute or IModelBinder to ensure that an enum property exists in the JSON body and has a valid value?

Given a model that looks like this: public enum Types { Emergency, Notice, Event } public class Message { public Types Type { get; set; } public string Title { get; set; } } And ...
SiBrit's user avatar
  • 1,490
0 votes
1 answer
57 views

C# complex Json to list<>

I try to DeserializeAnonymousType a json file with Newtonsoft. Every thing i do is oke till the channels seccion. user_info - Deserialize oke server_info - Deserialize oke categories, ...
A de V.'s user avatar
0 votes
1 answer
40 views

Correct way to create a Version object from string such that it can easily be serialised / deserialised [duplicate]

Consider the following line of C# code: ProtocolVersion = new Version("6.10.7011"); So that parses the string and creates the object no problem, however it sets the Revision to -1 by ...
komodosp's user avatar
  • 3,526
2 votes
1 answer
60 views

Serialize a JSON Object to Dictionary<string, string> [duplicate]

I have an object of the following class structure: public class Customer { public string ID { get; set; } public Address contact { get; set; } } public class Address { public string city {...
Impostor's user avatar
  • 2,022
-2 votes
0 answers
76 views

Newtonsoft.json issue and is not getting resolved

I have a problem with this Newtonsoft.dll and I have been working for over 2 hours reading posts about this and trying to fix this issue. I have uninstalled and reinstalled from the package manager: ...
Scot's user avatar
  • 21
1 vote
0 answers
24 views

Deserializing using JSON.NET [duplicate]

I am new to JSON and am trying to understand how to use JSON.NET to deserialize the following JSON response. { "student 1": { "first_name": "Peter", "...
Paul Lee's user avatar
0 votes
0 answers
30 views

Newtonsoft/JSON.Net won't parse arrays in JSON file (C#) [duplicate]

I'm trying to deseralize a json file into a C# object using Newtonsoft, but it's not transferring into a list properly. My object is this: public class MaterialTemplate : INamed { public string ...
William Rave's user avatar
0 votes
0 answers
56 views

How to discard property being written from json converter?

Requrement. For json serialization with json.net: Convert invalid double values (e.g. double.NaN) to null. Make double shorter (G3). Do not write properties with null values. Sounds simple? The ...
Sinatr's user avatar
  • 21.8k
0 votes
1 answer
47 views

Difference between PopulateObject and DeserializeObject (Newtonsoft JSON)

I'm wondering what the difference is between the two functions. It seems they achieve the same thing except DeserializeObject will zero out any existing values in the target object if they aren't ...
pks's user avatar
  • 85
1 vote
1 answer
53 views

How can I declare a dynamic property name starting with an @

I need to create the following JSON: { "@context": "https://schema.org", "@type": "Event", "name": "The Adventures of Kira and ...
David Thielen's user avatar
-1 votes
0 answers
22 views

Safe newtonjson rollout from 7x to 13x

Our .net framework application has many tight references with newtonsoft 7x. 3 years ago, previous owners tried to upgrade it to 10x - but due to multiple production issues, rolledback to 7x. Now I am ...
Obama's user avatar
  • 1
1 vote
0 answers
53 views

How to preserve the type of an enum used as a dictionary key when serializing with Newtonsoft.Json?

I have the following enum which I am using as keys in a Dictionary: public enum SomeEnum { One, Two, Three } And the following code throws an exception: Dictionary<Enum, string> map = new ...
user1595443's user avatar

15 30 50 per page
1
2 3 4 5
923