33,507
questions
-1
votes
2
answers
37
views
Deseralizing JSON Issue... My code or My File?
I have a JSON I'm trying to deseralize in C#. I have set up several classes to model the data format of the JSON contents. I have built some data classes for other JSON's. This one is giving me issues....
1
vote
0
answers
27
views
Does TypeScript @peculiar/asn1-schema library always wraps objects into ASN.1 SEQUENCE?
I have following class in TypeScript:
import {
AsnSerializer
} from '@peculiar/asn1-schema';
export class Element {
constructor(
public value: BigInteger
) {}
public ToASN1():...
1
vote
1
answer
53
views
java.lang.NoClassDefFoundError: kotlin/uuid/Uuid when using JsonContentPolymorphicSerializer
I would like to use JsonContentPolymorphicSerializer to dynamically deserialize field of JSON. Deserialization is working great, but when I try to serialize object into JSON, following exception is ...
1
vote
1
answer
44
views
MutableList<T> not being serialized in Kotlin
I'm working on a simple chat server, using kotlin to learn it along the way
I've defined the class to store any message as
@Serializable
data class Message (
var id: Int = messageCounter....
0
votes
2
answers
61
views
+50
Default serialization option for reference handler while setting up JsonSerializerContext
I'd like to set the default serialization option for reference handler to ignore cycles. I noticed JsonSourceGenerationOptions does not have a property for reference handler unlike ...
-3
votes
0
answers
44
views
Hashcode is different between the bytes read directly through file and bytes obtained after serialization/deserialization [closed]
I am getting different hash codes for the input steam for a json files in following two scenarios:
Reading file directly
InputStream sourceFileInputSteam = new FileInputStream(sourceFile)
int hashCode ...
1
vote
1
answer
28
views
JsonDecodingException with custom serializer
I am trying to write custom serializer, because I need to deserialize object into string. Deserialization of object is done correctly, but when I try to deserialize simple String I got exception:
...
0
votes
0
answers
34
views
NullReference in JSonConvert although settings mention how to handle Null values, what to do? [closed]
I have following piece of code:
JsonSerializerSettings settings = new JsonSerializerSettings();
settings.NullValueHandling = NullValueHandling.Ignore;
string str_jobs = JsonConvert.SerializeObject(...
-2
votes
0
answers
15
views
Best way to serializing textures in game engine save system [closed]
I'm developing a save scene system for my game engine, and I'm using YAML for serialization. I've encountered a challenge when it comes to serializing textures within entity components.
Currently, my ...
0
votes
1
answer
39
views
Best way to get immutable objects that are also serializable
I use PHP 8.3.11 and Laravel 11.22.0, and I want to have immutable DTOs that are also serializable.
My best idea so far was this:
trait SerializePrivate
{
public function jsonSerialize()
{
...
0
votes
2
answers
24
views
Python - Pydantic serialiser transform in other model
I want to use Pydantic 2 to export data to a Kafka Sub Queue and I need to export to JSON in a different model.
For example I have following object:
class obj(BaseModel):
resource: str
...
0
votes
0
answers
30
views
ASP.NET / VB.NET on .NET 4.7.2 : error in Inheriting attributes
I have this beneficiary class that inherits the attributes of Person class but when I use Beneficiary class I get this error:
Can anyone help me with this? Thank you!
I already tried every solution I ...
0
votes
1
answer
21
views
Why can't I make a single method to add a single user or a list of users in my POST request?
I'm learning a little about Rest Controller in Spring Boot, and i'm really a beginner, and i'm doing some tests here and this question came to me. This first option returned error 500. While ...
0
votes
0
answers
36
views
How to avoid StackOverflow error during JSON serialization of interconnected objects in Dart?
I have a Vehicle class in Dart, where each vehicle can be connected to another vehicle using a rope or some other connection. The class has three fields:
previousCar - The vehicle that is in front.
...
0
votes
0
answers
89
views
Convert JSON String to Unity C# String - Not Deserializing, Not Converting Into An Object
I have looked everywhere for the answer to this. I have a complicated, serializable Unity object, which captures various pieces of information (including complicated nested objects) about touchscreen ...
1
vote
1
answer
55
views
Convert JsonElement to property type
When implementing serialization of a static class, I encountered a problem with type conversion.
My code:
var properties = type.GetProperties(BindingFlags.Static | BindingFlags.Public);
var dictionary ...
-1
votes
2
answers
54
views
Send protobuf message as byte array from C++ to C#
I have a C# application and a C++ dll library. I want to make them communicate using protobuf. The C# app would be the caller and C++ the sender.
What I'm doing is the following:
caller.cs
public ...
-1
votes
0
answers
72
views
System.InvalidOperationException: Operation is not valid due to the current state of the object. System.Text.Json.JsonSerializer.Serialize(idocData)
I have a .Net project, that is throwing an error when I try to serialize large objects (above 100 parameters) into json.
This is the error I get:
System.InvalidOperationException: Operation is not ...
-1
votes
2
answers
52
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....
0
votes
1
answer
138k
views
Serializer for class xxx is not found. Please ensure that class is marked as '@Serializable' and that the serialization compiler plugin is applied
This question has been here countless times, but I just can't figure this one out.
I followed the documentation and other SO answers.
// My class
@Serializable
class DSFile(val name: String, val data: ...
-1
votes
0
answers
23
views
Jackson Deserialize Use default value when null [duplicate]
I would like Jackson to use default value during Deserialization if value if null. Since default value is used when JSON Property is missing I was hoping that using JsonInclude.Include.NON_NULL will ...
2
votes
1
answer
31
views
How to customize serialization of a key of a Map with jsoniter
I have a claas that jsoniter is able to create automatically a custom codec, except for the key of a map.
How to create a custom codec just for the key?
case class IconReference(area: AreaId, source: ...
1
vote
2
answers
111
views
How to serialize to strings only
I would like the output of serialization of properties of an object to be strings, even if they are int properties or bool properties.
using System;
using System.Text.Json;
public class Program
{
...
0
votes
0
answers
30
views
API Platform - return predefined array field instead of whole object on PUT
Is there a way to return an array field as a response in the PUT Processor class instead of the whole object like:
public function process(mixed $data, Operation $operation, array $uriVariables = [], ...
-1
votes
0
answers
35
views
How can I keep all my serializers in a separate package from my data models?
I have the following module structure for my Kotlin Ktor project:
module core
- class CartId
- interface IQuantity
- class UnitQuantity : IQuantity
- class MassQuantity : IQuantity
- class LineItem
...
0
votes
1
answer
25
views
.Net Remoting to WCF Data Serialization/Deserialization
I have a legacy application which is using .Net Remoting and I have to migrate it to WCF. So far I have successfully migrated the endpoints, service self hosting calling from client and it went good ...
0
votes
1
answer
42
views
How to consume plain text message from RabbitMQ using MassTransit in C#
I have configured the MassTransit RabbitMQ as following
services.AddMassTransit(x =>
{
x.AddConsumer<MessageConsumer>();
x.UsingRabbitMq((context, cfg) =>
{
...
0
votes
0
answers
16
views
Spring KafkaTemplate is setting some fields as blank after serialization
I have the following code snippet that should publish a message to kafka topic:
@SneakyThrows
public void publish(TransactionWebhookEvent event) {
val payload = printer()....
0
votes
1
answer
42
views
Implementing Infinispan (Data Grid) onto existing Spring Boot application and face problems with encoding
I have a existing Spring Boot 3 application that runs single node with Caffeine cache and the @Cacheable annotations.
The app runs fine so far, as Caffeine doesn't care about the POJO structure or ...
0
votes
1
answer
18
views
Serialized Object to JsonResponse return empty response using serializer service in Symfony 5 Controller
I use to add vue3 frontend content in a backend symfony 5,
I need to return a jsonResponse for sorting values in the front,
I did a Serializer Service to Serialize in Json an object which is from the ...
1
vote
1
answer
55
views
How to read a struct from a binary file using windows header file methods like fgetc?
Say I want to serialize some struct
struct SomeStruct
{
int a;
int b;
int c;
};
and I go about it using the Windows header file like so
#include "SomeHeader.h" //This is where the ...
0
votes
0
answers
20
views
Multidimensional arrays cannot be serialized from System.Text.Json
I wanted to serialize an object with a multidimensional array in it. Found out that its not a supported collection type by System.Text.Json.
Anyone know the reason behind it? Newtonsoft supports to ...
-1
votes
0
answers
20
views
EHCache org.ehache:ehcache:3.9.9 uses object serialization for On Heap cache
I have configured ehcache.xml in this form:
<cache-template name="default_template">
<expiry>
<ttl unit="minutes">10</ttl>
&...
-1
votes
0
answers
65
views
How to Handle Class Path Changes in Java Serialization with Redis Cache?
The @class property is used to include the class information of an object when it is serialized, allowing it to be accurately restored to the correct class type during deserialization.
(i'm using ...
-1
votes
0
answers
21
views
Serialize Nami Cardano address with pycardano
I'm building a dApp and want to connect my Nami wallet to my website. In the end I want to have something like a login with wallets and want to save these data to request wallet specific data on the ...
0
votes
1
answer
32
views
What could even be an error when loading a pickled file in Python?
The pickled file is voc_final.pkl, in the source code used in the paper GAMENet.
I tried to load it:
import dill
voc = dill.load(open("voc_final.pkl", 'rb'))
But got the error:
TypeError: ...
0
votes
1
answer
22
views
Is string deserializable JSON if the key names are not predefined?
I'm not sure if this is JSON that would be parsable into an object using a JSON deserializer:
{"reply":{"status":"OK",
"data":{
"PP6goL&...
0
votes
0
answers
28
views
Jackson Serialisation / De-Serialisation error (in Spring Security)
I'm persisting data to Redis, for my Spring Boot application.
This requires me to create a custom Jackson Object Mapper for the Redis Serialiser
Error
I keep getting this error though
GET "/...
-1
votes
1
answer
43
views
XML Serialization in C# Invalid Operation Exception
I'm trying to serialize the below XML into a class object, which I have listed below. I'm only interested in the planId and name attributes. I want this back as a list<Plan> objects.
<?xml ...
0
votes
1
answer
26
views
Jackson custom filter not triggered
I have a JSON object as:
{"username":"johndoe","email":"[email protected]",
"secretToken":"token123","secretKey":"password&...
0
votes
2
answers
44
views
What's the easiest way to serialize an opaque type with circe
Example:
opaque type UserName = String
This version is serialized automatically:
case class UserName(value: String) extends AnyVal
0
votes
4
answers
58
views
How to serialize one property of an object of arrays
I have the following model
public class MyModel {
public string Title;
public string Description;
public string Date;
}
I now have an IEnumerable object containing many MyModels
{
...
-1
votes
0
answers
47
views
serialize and deserialize `undefined`
undefined is not a valid JSON value so I am using a custom replacer function to serialize it. It works fine. However, when deserializing it, it works for both values and arrays (so my reviver function ...
-1
votes
0
answers
39
views
Unity: Calling Property Setter when Serialized Backing Field is Changed
I have a script that executes in both Edit and Play mode. It contains several properties with setters that do important stuff to keep the GameObject's data up-to-date. So I can edit the properties' ...
2
votes
2
answers
66
views
C enum implementing from_str and to_str functions? - Maybe an X-macro?
Given trivial typedef-free ANSI C code, how does one implement an X-macro to define everything in one place?
enum Foo {
CAN, BAR, UNKNOWN
};
const char *Foo_to_str(enum Foo foo) {
switch (foo)...
1
vote
1
answer
32
views
Generic serializer for custom data using attributes in C#
I want to create a generic serializer that is able to serialize and deserialize data provided in a specific enforced format. Lets say I have implemented two data structures with atributes (for JSON ...
0
votes
1
answer
37
views
Deserializing an "over-serialized" TF Sparse Tensor
adj_mx = tf.SparseTensor(indices=indices, values=values, dense_shape=dense_shape)
adj_mx_serialized = tf.io.serialize_sparse(adj_mx).numpy().tobytes()
I did this and saved as blob to sql.
I know what ...
1
vote
1
answer
31
views
Boost binary_oarchive not working with dynamic buffer
I'm trying to serialize an object using boost serialization. Everything works perfectly if I use a text_archive, I can serialize, deserialize back, and everything is in its place. I tried to serialize ...
0
votes
1
answer
44
views
serialize and deserialize dates
I want to serialize and deserialize dates using a custom format. For that, I'm trying to intercept the date during JSON.stringify() using a custom receiver
function serialize(data) {
if (data === ...
0
votes
1
answer
32
views
DRF API method with the possibility of dynamically transfer/recieve model fields
I need to write an api method in the Django Rest Framework that has the ability to get model fields and use them to get model values
I have written the following code for api method:
class ...