All Questions
7,376 questions
3
votes
1
answer
87
views
How Can I Ignore One Property based on JsonProperty Value of another Property during Deserialization?
I have the following class, how can I ignore the Response, if StatusCode == 400?
If StatusCode is 400, Response is returned in a different format that doesn't match my APIResponse class and throws an ...
1
vote
1
answer
85
views
How to split big JSON schema file into multiple files to use with Newtonsoft JSON.Net
I need to write a JSON schema file for some request/response structures of an API-project, so that I can use them with "Json.NET Schema". Because some of the objects are used in mutiple ...
-2
votes
1
answer
81
views
Change values in JSON file
I have a JSON file with nested values, I want to change any value in the file (ex: "supplierIdentifier" value is "002264HAM001" want to replace it to "0194711AMM00".
...
1
vote
1
answer
103
views
Problem with serializing object structure with Newtonsoft Json.NET
I have to serialize a data structure for a 3rd-party interface either to XML or to JSON. The expected result should look like the following (simplified) example:
XML:
<?xml version=\"1.0\"...
2
votes
1
answer
86
views
Update table according with JSON/JSONB
I have a table books :
Name of column
Type
id
int (PK)
name
text
nb_pages
int
And a table book_modifications :
Name of column
Type
id
int (PK)
old_data
jsonb
new_data
jsonb
book_id
int (FK)
Now let's ...
-1
votes
1
answer
67
views
Unexpected end of string while parsing json [duplicate]
I have the following json string:
{
"tables":
[
"%USER%.ABCDE_FAC_FINAL_%YEAR%",
"%USER%.ABCDE_FAC_STAGE_%YEAR%",
"%USER%....
1
vote
1
answer
41
views
Given an object graph composed of sub-classed of types which, how can we serialize that object to JSON while ignoring certain members of some types?
Given a C# object graph composed of subclasses of types which we cannot modify directly, what is the best strategy to serialize that object to JSON in .NET 4.6.2 while ignoring certain members of some ...
1
vote
1
answer
114
views
How to create a custom Json.NET converter to return a Json string that contains Json stored in the object being serialized
I have a C# class called MergeResponse that contains 3 properties:
MessageID
ApiResponse1
ApiResponse2
ApiResponse1 contains a class object instance that was created by Deserializing Json returned ...
0
votes
1
answer
70
views
JsonConvert.DeserializeObject<T> always returns T, how to deserialize json as T only if it is T?
I was suprised, that any valid json, even empty "{ }" can be deserialized by JsonConvert.DeserializeObject as any T class. The missing values will simply be default.
To example, I can't do ...
0
votes
0
answers
107
views
Convert Newtonsoft JObject to System.Text.Json JsonObject
I am trying to upgrade my solution from using Newtonsoft to System.Text.Json. One of the nuget packages that I can consume calls REST APIs which return complex objects that it deserializes using ...
0
votes
0
answers
32
views
Load deep nested schema using JSchema
I have a huge JSON schema with a part of it looking like this:
{
"if":{
"required":[
"product_category"
],
"properties":{
...
-1
votes
2
answers
59
views
Deserialising json with JSON.NET , unable to find the right class format [duplicate]
I receive a Json file. Now the other company change the Json and I have to find the right format for my class in C.Net and I'm not able to do so.
My Json looks like :
{
{"xxx": [
"...
0
votes
1
answer
78
views
Getting default values using TypeNameHandling in Newtonsoft JSON
I'm doing a basic serialize / deserialize with $type included to implement the outbox pattern. however I'm getting the default values.
Here's the code serializing :
JsonConvert.SerializeObject(...
1
vote
0
answers
134
views
How to read a JSON file using StreamReader in C# and skip invalid nodes
I am trying to read and process a large JSON file in C# using StreamReader and JsonTextReader. My goal is to read the JSON file node by node, and if any node contains invalid data (e.g., malformed ...
0
votes
2
answers
68
views
Deserialize json object as a string [closed]
I have a class A that has a field string data.
I perform a server request that gets me a json text that I convert to A:
var a = JsonConvert.DeserializeObject<A>(jsonResponse);
The problem is ...