336 questions
0
votes
0
answers
29
views
JsonInclude.Include.NON_EMPTY Doesn't Work after I implemented custom serializer on an attribute
I have a class which has Include.NON_EMPTY configuration on class level.
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
public class Item extends ExtraInfo {
String id;
List<String> ...
0
votes
1
answer
172
views
System.Text.Json throws TypeInitializationException in .NET framework unit tests
I have created a (fresh) solution in Visual Studio 2022 17.12.4 with the following projects:
ClassLibrary1 (.NET framework 4.8)
Has System.Text.Json installed version 9.0.1
Has a static method Just....
0
votes
0
answers
43
views
Configure source-generated JSON serialization for all types in assembly
I'm building an ASP.NET Core Web API for AOT publishing and need to configure source-generated JSON serialization for it, as reflection-based serialization will not work for AOT.
According to ...
0
votes
2
answers
74
views
How to serialize the recursive dictionary in C#?
Below class is the recursive dictionary (tree-like structure). The EntityID is just the alias of string which must be accessed via HierarchicalRelationshipsMap.EntityID.
public class ...
0
votes
0
answers
178
views
How can I add custom converters to Npgsql EF Core (8) traditional POCO mapping?
I need to use traditional POCO mapping to jsonb with PostgreSQL and EF Core (.net 8). The structure of those classes in fairly complex and I don't need to query them with Linq to EF. But I need to be ...
0
votes
1
answer
73
views
Not creating the .g.dart class in Flutter(Dart)
I have used the json_serializable library in flutter and created a class and created the Annotation of the library i.e. json_serializable in the class as below example:
import 'package:json_annotation/...
0
votes
1
answer
233
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 ...
0
votes
1
answer
48
views
Parent abstract class field missing in json-serialization toJson() method in flutter
In flutter, I'm trying to define a form field model. The form type is a enum, based on which different Field are to be returned.
My text field should look like this on toJson():
type : "text"...
0
votes
1
answer
32
views
Jackson custom filter not triggered
I have a JSON object as:
{"username":"johndoe","email":"[email protected]",
"secretToken":"token123","secretKey":"password&...
0
votes
1
answer
156
views
Flutter and Freezed: Parse a json element from either string or int, "Null check operator used on a null value" on build runner
I'm working with Flutter and using Freezed for my data types and json deserialization. The database I'm working with will sometimes send the ID element as an int (without quotations) or as a string (...
0
votes
0
answers
58
views
JSON serialization with a group by query ... how to?
I have an API endpoint to pull a big JSON blob from one of my models, and it works, but I'd like to improve it. The current implementation is below, and mostly just works using built in associations.
...
1
vote
0
answers
134
views
do not serialize empty collections (and handle accordingly in deserialization)
I have a bunch of POCOs that can be (de-)serialized from/to json. A lot of content is collections. I want the serialized JSON to only contain a specific property if its collection is not empty (...
0
votes
0
answers
77
views
Write Access Violation when Serializing rapidjson::GenericDocument with PrettyWriter to GenericStringBuffer
I am working with RapidJSON and trying to serialize a rapidjson::GenericDocument object using rapidjson::PrettyWriter to a rapidjson::GenericStringBuffer. Here is the relevant part of my code:
typedef ...
0
votes
0
answers
23
views
From String to JSON back to String properties order
I cannot find how JSON order object properties.
I thought it was alphabetical, but it seems it isn't.
I've tried to find how JSON ordering object properties but I can't find it.
0
votes
0
answers
93
views
ASP.NET Core use dependency injection for custom type in xml output formatter
In my ASP.NET Core project, I have a custom type which needs to be serialized using some external service:
public struct MyCustomType
{
private int value;
public MyCustomType(int value) { ...