546 questions
2
votes
1
answer
36
views
System.Text.Json.JsonException: 'Read unrecognized type discriminator id 'new-type'
I have a json document, that constantly increases the list of discriminators.
My problem is that I can't get the "UnknownDerivedTypeHandling" to work.
System.Text.Json and .net9.
// https://...
0
votes
1
answer
41
views
JsonSerializer.DeserializeAsync Fails Under High Load in ASP.NET Core Application
I'm encountering an issue in my ASP.NET Core application where System.Text.Json.JsonSerializer.DeserializeAsync fails under high load. When multiple requests are made simultaneously, the application ...
0
votes
1
answer
45
views
How to achieve JSON serialization with inheritance in Dart using json_serializable?
I'm working with Dart and the json_serializable package to manage JSON serialization for my models, and I have encountered an issue regarding inheritance.
I have the following base model:
@...
0
votes
1
answer
73
views
Why RestSharp is unable to deserialize the received JSON?
I'm trying to retrieve a list of users of my JIRA instance:
options.Authenticator = new HttpBasicAuthenticator(_jiraConfig.UserName, _jiraConfig.Token);
options.BaseUrl = new Uri(_jiraConfig.Url);
...
0
votes
0
answers
72
views
Issues with Jackson Serialization in a Camunda Application
I am working on a Camunda application using Jackson for JSON serialization. Recently I have been experiencing issues with serializing Camunda objects.
Details:
Camunda Version: 7.21.0
Jackson Version: ...
-1
votes
2
answers
20
views
Trying to skip one level when generating Json from wrapper class that contains two classes
So I have this domain class in a spring boot app for a REST API, that contains two subdomain objects:
public class Maximize {
private Profit profit;
private Stats stats;
...
The ...
1
vote
2
answers
66
views
In Dart, how do I serialize classes to and from JSON without using `dynamic` and without using code generation? Like Netwonsoft for C#?
I have a class like this:
class UserModel {
String id = '';
String firstName = '';
String lastName = '';
String email = '';
String phoneNumber = '';
String? createdDate = '';
String? ...
0
votes
0
answers
53
views
Xunit Serialize/Deserialize Custom Type
I'm trying to serialize / deserialize a unique type as part of an xunit c# test.
The type is
List<GraphicTestCase<TPage>> _testCases = new();
GraphicTestCase looks like the following:
...
0
votes
1
answer
41
views
Spring boot Jackson deserialization error. Invoking un-needed foreign fields
I'm trying to make a post method that accepts a 'food' item and saves it. The food entity has two foreign fields called "restaurant" and "menu". When I send the request, for some ...
0
votes
0
answers
42
views
The JSON value could not be converted to - fail
I have one of these awful scenarios; My Api was working this morning, the JSON response was being deserialized to an array of myObject[] using the line of code below. Then I added a field to the ...
0
votes
0
answers
174
views
Swagger UI failed to serialize object with Minimal API .NET 8
I setup Minimal API with .NET 8 and enable Swagger and Swagger UI.
var builder = WebApplication.CreateBuilder(args);
builder.Services.ConfigureHttpJsonOptions(options =>
{
options....
0
votes
0
answers
31
views
Very strange behavior of System.Text.Json.JsonSerializer.Deserialize [duplicate]
public class StagingModel
{
public string? TableName { get; set; }
public string? ConnectionName { get; set; }
public long? TimeStamp { get; set; }
public ...
0
votes
0
answers
52
views
Spring Boot Redis Cache DefaultSeriaLizer Problem
I'm trying to implement Redis caching in my Spring Boot project to cache user profile information retrieved by the getProfileByUsername method in the UserService class. However, encountering a ...
0
votes
0
answers
59
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 ...
1
vote
1
answer
117
views
Showcasing deepDiff results in json content as highlights using Angular?
I am using deepDiff to show the differences between two jsons in a structural manner, so far so good. But I want to highlight the differences, within the parsed jsons contents. It is not really ...
0
votes
1
answer
61
views
De-serialize JSON string into .NET object
I have a JSON string something like below:
[
{
"movie title": "The Matrix",
"release date": "1999-03-31",
"movie rating": 8.7,
"...
0
votes
1
answer
78
views
Jax-RS app with Payara server dosen't serialize Color via custom Serializer
I'm developing JAX-RS based application and Payara server. I want to serialize build in java Color class to String format: color = "RcolorValu, GColorValue, BColor value". For example in ...
0
votes
0
answers
242
views
Newtonsoft.Json.JsonSerializationException error when json generated on .NET 8 and consumed in .NET 4.8
I am having trouble passing data between 2 processes that are using different .NET versions (.NET 8 and .NET 4.8).
The nature of the data is such that the data type is define as 'object' so that ...
0
votes
1
answer
70
views
Nested Json Serialization Doesn't Work Event With explicitToJson: TRUE?
I am new to flutter and have been developing a small api that would pull data from a local mock database I created. The database has a nested Json within it, and no matter what I did, I can't get it ...
0
votes
0
answers
245
views
Kafka Producer - JSON Schema Refistry - Unknown Schema Registry Error: b""
I want to use confluent_kafka.Producer (python client) to generate messages in JSON format and produce them to the Kafka topic, and, first of all, I want to test it locally:
the Kafka-stack is running ...
0
votes
0
answers
19
views
How get T when JsonSerializer.Deserialize into generic class?
The the following json was deserialized:
{
"RESPONSE": {
"MASDAT": [],
"TEXTS": [
{
"COMPANY": "",
...
0
votes
1
answer
97
views
Using Winforms .NET framework JsonSerializer to serialize a string of filepath but it's returning a filepath including /debug/ folder path
I am an old noobie so I am sorry if I'm confusing.
I am creating a music player app in .NET Framework Winforms.
All I have been trying to do is create a method that serializes the string of folder ...
0
votes
0
answers
77
views
.NET 8 : deserializing of HttpContent Int payload returns null
New to .NET 8.0. I am posting to a Rest API and expect the returned payload to be an id number. I am attempting to deserialize an HttpContent stream into a class called Result<T> where T is a ...
0
votes
1
answer
110
views
C# how to serialize JSON array of objects and convert object name to property value
I have a JSON string which has an array of objects. I need to serialize into a .NET class and use the object name as a property value.
public class DocumentFieldMap
{
[Key]
...
2
votes
1
answer
1k
views
FLURL 4.0 use Newtonsoft JSON Serializer on a single request
Referencing Flurl Serializers it shows that Flurl 4.0 can use the Newtonsoft based serializer, but it is not clear to me how to do this for a single request. I need this to address a circular loop ...
-2
votes
2
answers
61
views
C# Map JSON Serialization and Deserialization to Reference Object Using Object Property
I have two JSON files: One for Locations, another for Objects at a location.
locations.json =>
[
{
"Name": "Location#1",
"X": 0,
"Y": 20
},
...
5
votes
2
answers
559
views
Memory leaking in .NET HttpClient, JsonSerializer or misused Stream?
I have a basic background class in an otherwise empty ASP.NET Core 8 Minimal API project.
App startup is just:
builder.Services.AddHttpClient();
builder.Services.AddHostedService<...
1
vote
1
answer
359
views
How to ignore empty strings in API JSON response?
I have an API developed in .NET6. Currently, all properties that are being returned as null, are being hidden via the below:
_ = services.AddControllers().AddJsonOptions(options => {
options....
0
votes
2
answers
317
views
Change property names conditionally during serialization
I have model classes ClassA and ClassB.
These classes are returned as result from two controllers: XController and YController.
When returning these classes as result from YController, default ...
0
votes
0
answers
86
views
Unable to Sync Android Studio Gradle files in order to work JSON Serialization
So basically I am unable to get the imports for content negotiation json serialization even though I thought I had does all the necessary imports and plugins.This is the code that I am trying to ge ...
1
vote
1
answer
125
views
JsonSerializer deserialize custom JSON
I have a json-file that has the following format:
{"0":{"Height":190,"Left":1640,"Top":170,"Width":600},"1":{"Height":52,"...
-1
votes
2
answers
303
views
C# JsonDocument.Parse() Auto casting
I'm coding using C#.
When GET request, I get json format string like
{ "code": 2312, "price": 98.322, ... }
to parse, I use System.Text.Json.JsonDocument.Parse(jsonString) function....
0
votes
1
answer
204
views
How to generate a JsonSerializable with extended class
I'm creating a product app in clean architucture, I want to generate json but I cant to do it with JsonSerializable but I cant do it I always get error
Could not generate `fromJson` code for `...
0
votes
1
answer
41
views
Javascript global functions and variable reseting
I have some global functions which I need to use different places of my project. In one page, I have to open different pages based on the data I have in my current tab. I have to change my local ...
0
votes
1
answer
85
views
How can I solve the error _Map<String, dynamic>' is not a subtype of type 'List<dynamic>?' in type cast
I want to fetch by id and I get this error.
In the MarsatmasResponseModel, when you bring the data with an id of List type, Marsatmas is returned.I get this error.
Parse Error: type '_Map<String, ...
0
votes
2
answers
499
views
I want to use get set method in field of data class kotlin
data class Thermostat(
// ... other properties
@SerializedName("units")
private var _units: String?, // Fahrenheit,
// ... other properties
) : Serializable {
var units:...
0
votes
1
answer
93
views
How can I use generic structure with JsonSerializable
Since my data can be of Cart or List type, I wanted to use a generic structure.What could I have done wrong in my code when using generic type with JsonSerializable?.My codes are as in the photo. How ...
1
vote
0
answers
50
views
Mark properties as required for deserialization with Microsoft's JsonSerializer in NET 6
I'm using microsoft's JsonSerializer
Attributes to mark properties as required have been introduced with .NET7
Unfortunately i'm working with .NET6
I need to detect when a property is missing from the ...
1
vote
1
answer
40
views
Circular reference in JsonSerializer
I have a list of objects with links to each other to get a double linked chain. Although I marked the links not to be considered in the serializer I get the message
"A possible object cycle was ...
1
vote
0
answers
38
views
OpenAPI `v3/api-docs` returning an array of ascii integers instead of OpenApi json
My OpenApi Config class is
@Configuration
public class OpenApiConfiguration {
@Bean
public OpenAPI customOpenAPI() {
return new OpenAPI().info(apiInfo());
}
private Info apiInfo() {
return ...
1
vote
0
answers
91
views
Json Serialization of Large data object using c#
I am working on an application where I want to serialize a large data set object. The problem is that it serializes the object very slowly and my file uploaded on FTP is incomplete JSON. Here is my ...
2
votes
1
answer
365
views
How to serialize a list of objects of a class that contains a list of a struct
I have a list of objects of a class that is composed of simple properties and a property that is a list of a struct
struct UGdata
{
public int ID;
public float curGen;
public float nomGen;
...
0
votes
0
answers
107
views
How to remove a property name of a JSON with @JsonValue without deleting more properties of my object
I try to make a JSON with a 3 propertys, "items", "status" and "id", but if i use @JsonValue, my JSON don't take "status" and "id"; How can i make ...
1
vote
0
answers
201
views
How to have multiple build configuration for build.yaml file
In json_serializable package we can define a build.yaml file to configure diffrent options. I have 2 folder for my models, one folder is for requests and the other is for responses.
I want to know how ...
0
votes
0
answers
624
views
How can I accurately represent a decimal value to two decimal places in a JSON object in .NET?
If I retrieve a value of 1000 from the database, I want to display it as 1000.00. Currently, I am only able to display it as 1000.0, and I don't want to display it as a string format
{
...
-1
votes
1
answer
65
views
Json Serializer Populate with CreateReader not mapping
Could be one of those days where I can't see what is infront of me but when I try to use the jsonserializer Populate function to map to an object - it fails to do so, and I'm not sure why. the object ...
0
votes
0
answers
49
views
StackOverflowException when calling JsonSerializer.Serialize with options [duplicate]
I wrote a custom converter for a JSON object that accepts different types of values in a .NET 6 web API. I registered this converter in my Program.cs class like this:
builder.Services.AddControllers(...
-1
votes
1
answer
5k
views
The JSON value could not be converted to System.Collections.Generic.Dictionary`2[System.String,System.String]
Before serialize -
"welcomePageConfig": {
"welcomeTitleText": {
"style": {
"color": "#FFFFFF"
},
...
-3
votes
1
answer
65
views
Converting JSON to C# class deserializer errors on List [closed]
I have this JSON object - in view mode
[{
"Urltitle": "",
"location": "",
"Url": ""
}, {
"Urltitle": "",
...
0
votes
2
answers
11k
views
'<' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0
I have a Web two Web API services, once service which returns byte[]
1st API which returns byte[]
[HttpPost]
[Route("compile")]
public async Task<byte[]> GetData([FromBody] Data myDto)...