13,841
questions
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 ...
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 ...
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....
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 ...
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, ...
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 ...
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 {...
-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:
...
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",
"...
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 ...
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 ...
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 ...
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 ...
-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 ...
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 ...