2,400 questions
0
votes
0
answers
21
views
.net 9 - Make JSON deserialization more performant? [closed]
I'm dealing with an app that is meant to consume thousands of events per sec. The particularity here is that those events are very, VERY similar to one another. They not only follow the same schema, ...
0
votes
1
answer
30
views
Json Deserialization from reader (Utf8JsonReader)
I'm calling JsonSerializer.Deserialize(ref reader, options), but for some reason it isn't working.
public class WeatherForecastJsonConverter : JsonConverter<WeatherForecast>
{
public ...
0
votes
1
answer
34
views
Service Bus SendMessageAsync failing when ApplicationProperties is set with values from a Json Deserialized Dictionary<string,object>
I have a scenario I need to set ApplicationProperties to a Azure Service Bus message. I have dictionary of key, value type <string,object>. I also use System.Text.Json for deserializing the ...
0
votes
2
answers
58
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 ...
3
votes
1
answer
79
views
Loading a file from disk and use that as value during json deserialization
So to be clear I am going to present a working solution to that problem using Newtonsoft.Json 13.0.3. Said solution does not look very good and I am looking for a better one.
Some context, this is ...
0
votes
1
answer
29
views
JSON::SerializableError when deserializing PascalCased properties using JSON::Serializable in a Crystal app
I’m developing a Crystal application and consuming an API that inconsistently uses PascalCase for some of its endpoint properties, rather than camelCase. Unfortunately, this causes issues with JSON::...
0
votes
1
answer
81
views
JsonConverter does not work when data is received from Form
I have added a custom json converter to trim all strings coming to the web api during de-serialization, like this
options.JsonSerializerOptions.Converters.Add(new TrimStringJsonConverter());
And this ...
-1
votes
1
answer
51
views
Issues accessing API data as string array
I am creating an API to receive data from a webhook and process it. I've set up a class to contain the POST data and can access all but one of the fields - the groups, which is set up as a string ...
0
votes
0
answers
54
views
MariaDB building dynamic JSON_ARRAY conditionally, prevent casting JSON_OBJECT to string and double-quoting
USE CASE: We want to create a JSON_ARRAY containing various JSON_OBJECTS. These objects are added if (and only if) certain conditions are true. If they are false, then that object should not be added ...
0
votes
0
answers
34
views
Jackson Polymorphism using ID.DEDUCTION [duplicate]
I have a class hierarchy which I try to serialize and deserialize. I understand that the easiest way to go about it is using Id.DEDUCTION - I'm trying to make it work on the following code but I get ...
0
votes
1
answer
55
views
Json deserialization does not set certain object property
I have this class definition:
public class TrabajadorViewModel
{
public int ID { get; set; }
[Display(Name = "Habilitado")]
public bool Habilitado { get; set; }
[Display(...
-1
votes
2
answers
85
views
JSON parse error: Cannot construct instance: no int/Int-argument constructor/factory method to deserialize from Number value
I am trying to insert user record using mysql database
Customer.java
@Entity
@NoArgsConstructor
@AllArgsConstructor
@Data
public class Customer {
@Id
@GeneratedValue(strategy = GenerationType....
1
vote
2
answers
61
views
Deserialize json field that may be either array or map
I'm getting json data from server API to Android app (Kotlin Serialization + Retrofit)
I need to parse a Json with field errors. The issue is the structure of this field.
If there are no errors I get ...
0
votes
0
answers
42
views
ASP.NET Core: Is there a way to throw multiple errors in a custom JsonConverter? Or access the ModelState?
I have problem inside a custom JsonConverter that I am potentially catching multiple errors (through attempting to deserialize the JSON, and if it fails, remove the offending propertry and try again) ...
0
votes
1
answer
37
views
Cannot apply indexing with [] to an expression of type object
I'm working on API on the .NET Windows form. I copied the code from the website provided and I found an error
say:
Cannot apply indexing with [] to an expression of type 'object'
How to fix this?
...
1
vote
0
answers
28
views
Spring, deserialization and kotlin nullable types
Let's imagine I have the following classes:
data class MyClass1(
val someField1: String,
val myClass2: MyClass2?,
)
data class MyClass2(
val someField2: String,
val someField3: String?,
)
...
0
votes
0
answers
36
views
How do I deserialise a class property of type Object in VB Net with System.Json
In VB .Net, I use System.Json to (de)serialise a class called Model. This class has a list of changes, where a change has three properties: PropertyName, OrignalValue and NewValue.
The PropertyName ...
-2
votes
1
answer
62
views
C# JSON: I want to deserialize an empty string to a custom type. But it seems to be always defaulting to null. Is there a way to achieve this
I want JsonConvert.DeserializeObject<CustomType>("") to be deserialized to new CustomType()
but this is always deserialized to null.
this is using Newtonsoft json, have tried using a ...
1
vote
0
answers
102
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
40
views
Receiving Null values from Eventhub streaming
I am new to PySpark, and facing an issue while consuming data from the Azure eventhub. I am unable to deserialize the consumed data. I see only null values upon deserializing data using the schema. ...
-2
votes
2
answers
93
views
Deserialization error on the 3rd library class instance in the class (using Lombok annotations) [duplicate]
I want to use a 3rd party (external) class instance in a class but I am getting this error on deserialization:
Cannot construct instance of org.springframework.data.geo.Point (no Creators, like ...
2
votes
1
answer
174
views
What is the proper way to customize deserialization process for JsonNullable of particular type
I want to customize JsonNullable<Boolean> deserialization process. So I've found the class JsonNullableDeserializer :
I've implemented my own deserializer:
public class ...
0
votes
1
answer
202
views
Why is using JsonSerializer.DeserializeAsyncEnumerable to deserialize a 1GB file resulting in 2GB+ memory allocation?
I need to deserialize a 1GB json file one element at a time in a streaming fashion and after doing some reading found JsonSerializer.DeserializeAsyncEnumerable to enable this while also keeping the ...
0
votes
0
answers
74
views
How to deserialise from json to SearchResponse <Object> in Java
I've created a jsonResponse like this.
HttpResponse<String> httpResponse = client.send(request, HttpResponse.BodyHandlers.ofString());
String jsonResponse = httpResponse.body();
Now when I'm ...
0
votes
0
answers
51
views
@JsonDeserialize not considered when using parameter-names
I have some POJOS that I want to (de-)serialize with jackson. All my classes have only one public constructor, with one argument for each field. In order to avoid needing to write all these @...
1
vote
1
answer
40
views
Configure Jackson Deserialzer using static method for types with a given super class
Currently I am getting an exception when deserializing a codestable typed class.
Imagine the following scenario:
public abstract class AbstractCodestableEntry implements java.io.Serializable {
...
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
0
answers
28
views
JSON Question - How Do I deserialise only certain elements? [duplicate]
I'm new to JSON and have got most of the way there to handing my API calls get. One set of data returned comes back as this (field is called jsonResponse)... My question is how do I only get a list ...
0
votes
0
answers
27
views
Unable to inject custom @JsonFilter in SpringBootTest
I have a data class for which I use a custom JsonFilter
@JsonFilter(value = "conditional_serializers")
data class DocumentRequest(
val someField: String? = null,
val someOtherField: ...
0
votes
0
answers
44
views
creating C# classes by parsing jsondoc JSON file?
I am consuming an REST API (Contrast Security ) which unfortunately for me, does not provide Swagger documentation. It does provide JSONDoc, and I'm able to extract what looks like a JSONDoc JSON file ...
0
votes
0
answers
244
views
How to serialize and deserialize nested java objects when sending object to Kafka topics and receiving at consumer end using only Jackson
I am new to custom serialization/deserialization and also using it in Kafka is even more new for me. I am trying to explain what I am doing and also what I want to achieve. Please comment if you need ...
0
votes
1
answer
62
views
How do I deserialize additional properties present in a type for which a converter already exists?
I am attempting to deserialize a geojson FeatureCollection. The API I am querying returns this feature collection with additional properties on the type. The properties are used for cursor-based ...
0
votes
1
answer
104
views
Using upickle read in Scala 3 macro
Try to write a generic macro for deserialising case classes using uPickle read in Scala 3:
inline def parseJson[T:Type](x: Expr[String])(using Quotes): Either[String, Expr[T]] = '{
try
Right(...
11
votes
3
answers
1k
views
Unable to get route object from currentBackStackEntry in Compose Navigation outside NavHost composable block using toRoute extension
I am working on a project that utilizes Jetpack Compose Navigation with Type-Safe Navigation. Within my application, I have an composable function responsible for hosting the navigation graph. Here's ...
1
vote
0
answers
44
views
"Option type"-esque deserialization of API response in .NET Core [duplicate]
I'm using .NET's native JSON utilities (System.Text) to perform automatic Serialization/Deserialization of data going to and from an API. The API responses are structured like the following:
{
&...
1
vote
1
answer
505
views
How can I use Jackson's @JsonAnySetter with a record class?
I'm trying to use Jackson's feature to deserialize unknown fields into a map, using @JsonAnySetter. This works fine for a Java class with the field annotated with @JsonAnySetter, but does not work ...
0
votes
1
answer
67
views
C# - Deserialize DateTime & DateTimeOffset values to UTC and Local Time as required
I'm currently working on a full stack application that has never had to be conscious of time zone, but looks like it will soon need to be a bit more versatile in terms of being aware of local time ...
1
vote
1
answer
430
views
Using kotlin kotlinx serialization with generics
Hi everyone I have the following code that I use to serialize into json strings to store in shared preferences
interface Serializer {
public fun <T> serialize(data: T, type: Class<T>): ...
0
votes
2
answers
110
views
Serializing data to json with multiple circular dependencies
I'm working on some code that serializes and deserializes a complex data structure.
I have a data model in C# consisting of three classes: TypeA, TypeB, and TypeC.
TypeA has a reference to TypeB, ...
0
votes
1
answer
80
views
ASP.NET - Reading JSON file
I have a JSON file, please tell me how can I read that file. I have created a class file, and want to save JSON data in those class properties.
{
"header": {
"hid": "...
0
votes
0
answers
89
views
How can I specify which class to deserialize an interface to in System.Text.Json in C#
Background
I am developing a chat application in C#. My solution consists of 3 libraries: One for the server, one for the client and a shared library that both the server and client use. The server ...
1
vote
1
answer
136
views
Custom JsonConverter for serializing JSON to abstract class
I am working on deserializing a complicated json structure as following, which "id" under "events" represent
"events": [
{
"id": 1,
"actions": ...
1
vote
1
answer
490
views
using NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE
I'm building on Visual Studio 2019 and using nlohmann json.hpp
And getting this compiler error:
C2679 binary '=': no operator found which takes a right-hand operand of type 'const TestClass1' (or ...
0
votes
1
answer
264
views
Unable to deserialise ProblemDetails returned from Webapi
I have two micro services written in C# running on .NET 8.0.
WebApiOne has a GlobalHandler that implements IExceptionHandler that returns the following:
var problemDetails = new ProblemDetails
...
0
votes
0
answers
44
views
Problem when deserializing a nested object JSON
I have an application on WinForms for one user that stores a list of categories of expenses and income, as well as expenses and income themselves.
public class User
{
[JsonIgnore]
public ...
0
votes
1
answer
89
views
Deserialize and serialize ZonedDateTime fields in shared objects between controller based on which controller it is used as a parameter for?
I have this Object, which has a field that is a ZonedDateTime:
import java.time.ZonedDateTime;
public class TestObject {
private ZonedDateTime testTime;
public ZonedDateTime getTestTime() {
...
0
votes
2
answers
189
views
Deserialize escaped string into Vec<String> with serde
Newbie in Rust here.
I'm having some difficulties parsing a escaped json string into a Option<Vec<String>>.
I have an api that's returning a collection of items, and one of the properties ...
0
votes
0
answers
905
views
Insecure Deserialization in C# (.NET) using NewtonsoftJson
I am working on a Web API that needs to call a 3rd party Web API to achieve some features. That 3rd party's API's design is sort of a "God API" such that it takes a generic object type to ...
0
votes
0
answers
112
views
No method found for class java.lang.String in Kafka
I have producer and consumer configuration
Producer
@Bean
public KafkaTemplate<String, BeltEventDescription> kafkaBeltEventDescriptionTemplate(final ProducerFactory<String, ...
0
votes
0
answers
104
views
I dont understand what to do with: System.Text.Json.JsonException: 'The JSON value could not be converted to System.Collections.Generic.IEnumerable`1
I am writing a console application in C#, VS2022.
Where I receive a json string from Orchestrator (Uipath), try to deserialize it to an IEnumerable.
I've spent all day reading everything about this ...