Questions tagged [serialization]
Serialization is the process by which data-structures are converted into a format that can be easily stored or transmitted and subsequently reconstructed.
33,205
questions
-1
votes
0
answers
11
views
We are upgrading Azure search from Version 10 to version 11.4, The geography points are serialized different from previous version
Version 10 Geogrphy Point serialization output:
"location": {
"latitude": 39.2428832397,
"longitude": -75.8474861165,
"isEmpty": false,
&...
0
votes
1
answer
37
views
Dart: using named constructor on generic type in class template for deserializing multiple classes using a generic interface
I want to create several objects that are serializable to a Map and deserializable from a Map so I can deserialize an entire List of such objects in other functions and methods. This is meant to avoid ...
-2
votes
0
answers
18
views
Error faced when using msal-web-sample : java.lang.IllegalArgumentException: Attribute with name principal is not java.io.Serializable
We had used ADAL library for managing the user authentication flow through Azure AD and are in the process of migrating to MSAL.
We are now using msal-web-sample code available in official ...
0
votes
0
answers
16
views
How to Consume Messages from RabbitMQ as Plain Text using MassTransit?
I'm working on a project where I need to consume messages from RabbitMQ using MassTransit. However, I don't want to deserialize or interpret the incoming messages as JSON. The producer's behavior is ...
0
votes
0
answers
42
views
Jackson annotation to exclude all fields except those specified
I am currently working on a Sprint Boot project and am using Jackson to handle DTO serialization and deserialization.
I am using the @JsonIgnoreProperties annotation to exclude certain fields from the ...
0
votes
1
answer
29
views
Execution strategy in GsonBuilder is not applied
I have the following example:
public class A implements Serializable {
int a;
B b;
...
@Override
public String toString() {
Gson gson = new Gson();
return gson....
0
votes
1
answer
39
views
Unity Newtonsoft.Json serializing int default value as string
When I'm serializing any class that have int field inside, when it's value is 0, it serializes it as string instead of int.
I have a class:
[Serializable]
public class ResourceData
{
public int ...
0
votes
0
answers
18
views
Exclude() is not working on nestjs post method response but working on get response
user.entity.ts
@PrimaryGeneratedColumn('uuid')
id: string;
...
@Column()
@IsString()
@Exclude({ toPlainOnly: true })
password: string;
user.controller.ts
@Post()
async create(@Body() createUserDto: ...
0
votes
0
answers
28
views
JsonIgnore is being ignored
I am using the GeoJsonSerializer as I need to serialize several geomtetries.
JsonSerializerSettings sett = new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }; // ...
0
votes
0
answers
37
views
How to serialize abstract classes with a large number of subclasses?
I am trying to serialize a class with a field containing another class, but the field name appears in the XML.
I have the following classes:
public class CustomExpression
{
[XmlAttribute] public ...
0
votes
1
answer
15
views
Jackson: Serialize the same object into multiple JSONs
I have two POJOs that look like:
public ResponseA {
private HeavyObject object;
private AdditionalDataA additionalData;
public ResponseA(HeavyObject object, AdditionalDataA additionalData) {
...
1
vote
1
answer
22
views
I have a field with current/permanent_address and I need to use this field with forward slash in my serializer
this is my serializer and I am not able to declare fields in my serilizer with forward slash
"address": {
"current/permenantAddress": {
...
1
vote
0
answers
39
views
Declare Pydantic V2 Json serialization logic in arbitrary class
I'm in the process of upgrading a Pydantic v1 codebase to Pydantic V2.
Pydantic has a variety of methods to create custom serialization logic for arbitrary python objects (that is, instances of ...
0
votes
1
answer
40
views
C# System.Text.Json Deserialize JSON-string with Cyrillic symbols - how can i prevent conversion to escape-string?
I'm trying to deserialize Json-string with cyrillic-symbols, and i get JsonObject with string-properties as escape string:
Source JsonString:
{"ERROR":"-","ERRORS":{"...
1
vote
1
answer
33
views
How to serialize Jinja2 template in PySpark?
I want to use a Jinja2 template to create a column in a df using PySpark. For example, if I have a column name, use the following template to create another column called new_name.
from jinja2 import ...
0
votes
0
answers
45
views
F# JsonConverter seems to be ignored in .NET7
First of all, the problem appeared once we upgraded to .NET 7. With the previous versions, both 5 and 6 the attr worked as intended.
There is custom JSON converter:
type RouteCheckConverter() =
...
0
votes
2
answers
50
views
Unable to deserialise kafka topic in a stream using avro serialisation
I have a Quarkus project and a kafka producer which has
SpecificAvroSerializer<MyObject>
which writes successfully to topic and I can see the message ok
Then I attach a stream to this topic ...
0
votes
1
answer
42
views
How to control the format of JSON text within JToken.ToObject()
I have a JSON structure that I'm parsing into an object, and the class has a string field. Sometimes that field will contain more JSON as its string value:
{
"answers":[
{ "...
0
votes
0
answers
7
views
python json2xml library not working as expected
I am using this library json2xml to convert a json string to xml, but its not working as expected.
This is the code simplified
from json2xml import json2xml
from json2xml.utils import readfromstring
...
-1
votes
1
answer
43
views
Serialising .NET object to JSON: `double` property value gets written as a different value with extra decimal places
I'm using System.Text.Json to (de)serialise between .NET Well class object and JSON. The Well class object has a List of layers List<Layer> layers, and the Layer class has a list of Items List&...
0
votes
0
answers
19
views
PHP Deserialize JSON array and Get object name [duplicate]
how to get the object name? e.g: “XXX.HOSTNAME”
$json = '{
"XXX.HOSTNAME": {
"IP": "123.195.214.93",
"IP6": "",
"...
0
votes
3
answers
114
views
C# - Deserialize array of JSON objects into Dictionary
{
"TestObjects": [
{"the": "goal"},
{"is": "to"},
{"deserialize": "this"},
{"simple": "array&...
0
votes
0
answers
39
views
How do update AddJsonOptions in .NET 6 at runtime anytime I send a request
I am working with .NET 6 and C#.In the startup.cs file, I have this option that is executed when the application starts:
services.AddMvc()
.AddNewtonsoftJson(options => options....
0
votes
1
answer
53
views
Persistent config with visitor pattern and static memory allocation
I'm preparing a persistent config module for an embedded project. I want to use serialization implemented using the visitor pattern:
struct softwareInfo
{
uint32_t version;
std::array<...
0
votes
0
answers
21
views
Building a pastebin app and can't to deserialize objects
Building a Java project(java 19) with spring boot(3.1.3) and gradle(8.2).
Also use a Google Cloud Storage and when getting data I want to deserialize data in the object with SerializationUtils,but ...
0
votes
2
answers
58
views
Understanding the pickled object size
I execute the following line in Python interpreter:
len(pickle.dumps([numpy.random.random(384).tolist()]*55))
It gives 3584.
Given that numpy.random.random produces 8-byte floats, the data being ...
0
votes
1
answer
51
views
Converting a Python object To XML without namespaces
I am using the XmlSerializer from xsdata to convert a python3.9 dataclass object into XML.
This is the code
# create serializer
XML_SERIALIZER = XmlSerializer(config=SerializerConfig(xml_declaration=...
0
votes
0
answers
13
views
How to access QuerySet in Serializers.py
Here is my serializer.py file
class StoreProductSerializer(serializers.ModelSerializer):
product = ProductSerializer(read_only=True)
product_id = serializers.PrimaryKeyRelatedField(
...
0
votes
1
answer
37
views
is there a way for optimize this piece of code?
I have these two model below:
models.py file:
class Profile(models.Model):
"""
User Profile Model
This model represents a user's profile information, including their ...
0
votes
0
answers
21
views
How to show a list with ManyRelatedManager objects in nested serializer Django
I have a Category model (Parent) and a Product model (Child) with a FK to Category.
Several products may belong to the same category and I want to show all products of a Category in GET request. But ...
1
vote
2
answers
42
views
Why does ObjectMapper serialization with JsonInclude.NON_EMPTY also remove null fields?
JsonInclude.NON_EMPTY and JsonInclude.NON_NULL are two Jackson annotations that can be used to control which fields are included in the serialized JSON output.
- JsonInclude.NON_EMPTY will ignore ...
-1
votes
2
answers
39
views
c# - Deserializing JSON array of integers and/or range of integeres
I've searched "all over" the internet and can't find a solution to my problem.
I want to deserialize the following string
{"retention": [
{ "kinds": [0, 1, [5, 7], [40, ...
0
votes
1
answer
31
views
Unhandled Exception: type 'int' is not a subtype of type 'String?'
class Task {
int? id;
String? title;
String? description;
int? isCompleted;
String? date;
String? startTime;
String? endTime;
int? color;
int? remind;
String? repeat;
Task({
...
0
votes
0
answers
94
views
Do reinterpret_cast double* to unsigned long long* constitue a strict aliasing violation? [duplicate]
To give some context, I'm focusing the case of data serialization/deserialization without being dependent of the platform endianness.
For integral types, we can use the bitwise-shifting operators for ...
0
votes
1
answer
74
views
How can I mask sensitive data only for logging in Spring Boot?
I'm building a Spring Boot application and want to save sign-in request data in db with user password masked. For example, if user passed "abc", I want to save it as "***". I've ...
-1
votes
1
answer
35
views
Java can an object be serialized if it uses non-serializable data in a method?
I have the following class:
public class Town implements Serializable {
public String name = "Town";
public String color = "White";
public ArrayList<UUID> mayors =...
3
votes
1
answer
147
views
How to safely deserialize MessagePack messages without throwing exceptions?
It's my DTO:
public class InvocationMessage
{
public string MethodName { get; set; }
public object?[]? Args { get; set; }
}
And initially I serialized it using MessagePackSerializer.Serialize(...
0
votes
0
answers
33
views
Apache Avro C++ serialization framework (native type flexibility)
Apache Avro usage for C++ stub generation, native types to c++ (e.g. char[max], bool, etc).
As an example I would like to produce given header stub file:
struct CommonStruct
{
int32_t SeqNum;
...
0
votes
1
answer
31
views
How do I properly serialize an object in Kotlin?
I am trying to serialize certain custom data types. For the simpler ones (like UUID) the approach described in Kotlin Serialization worked great. However I am running into some issues with more ...
1
vote
1
answer
76
views
Spring4D Nullable<T> JSON serialization
Is there a way to get TJson.ObjectToJsonString() properly serialize a TNullableInteger field in an object?
I tried to use an attribute on the field using a JsonReflectAttribute with a TJSONInterceptor,...
1
vote
2
answers
36
views
Java - Modifying and Serializing an Object concurrently
I have few questions related to concurrently Modifying and Serializing a Java Object. (The best approach would have been to try out and see the outcome and build the understanding around it but coming ...
1
vote
1
answer
43
views
Invalid json float conversion depending on server
I wrote a C library that returns some JSON strings using the json-c library. This library is used by a Tomcat Java server (through JNI), and the JSON is passed to a client browser and parsed by a ...
-1
votes
0
answers
46
views
c# Json Deserialize Fails in published version
I did 2 classes that i need to serialize and desearilize, when I test it in debug or release they works correctly, but when I test it in published version it fails. This are the classes that i need to ...
0
votes
1
answer
42
views
Find cause of NotSerializableException: java.util.ArrayList$SubList
I'm using redisson to save sessions of my app. The app uses JSF 2.3.
I'm trying to find the cause of a NotSerializable Exception, but the app only logs redisson stack. Basically it doesn't point to ...
0
votes
1
answer
18
views
WooCommerce unused images deserialize wp_postmeta Maria DB regex_instr workaround
I am trying to get a list of all the filenames from a set of posts in a WooCommerce Gallery, this list is the unused files attached to posts (I can't use Media Library unselected, because that doesn't ...
0
votes
1
answer
22
views
Hazelcast object equals for replace method callingfrom client
I have configured hazelcast map with in-memory-format: OBJECT.
Now I am trying to use method map.replace(key,oldValue,newVal) assuming that it will use defined equals method in my class. But I make ...
-1
votes
1
answer
71
views
Stringify Native Functions
As pointed out here, the common way to save an object containing a function in JavaScript/Node.js is to serialize the functions in that object, i.e. convert them to strings.
However, using this ...
0
votes
0
answers
16
views
Pickling custom/dynamic class definition throwing "No module named xyz" error
I have the following function that generates/returns a custom class and that looks something like this:
Let's say this function is stored in generate_class_module.py
def generate_class(custom_func):
...
0
votes
1
answer
51
views
Overriding structuredClone's serialization in JavaScript class
Suppose I have the following class:
class Foo extends EventTarget {
msg = 'hey';
}
Now, suppose I need to transfer an instance of this class via MessagePort to a new Window or Iframe. This calls ...
0
votes
1
answer
25
views
Problem Serializing Node Set to Print Label
I am a Digital Archivist and was recently hired at a new organization. Turns out they had a very critical database go down 1.5/2 years ago and I've been helping them get it back up and running. The ...