Skip to main content

Questions tagged [serialization]

Serialization is the process of converting an object into a stream of bytes in order to persist it to memory, a database, or a file. Its main purpose is to save the state of an object in order to be able to recreate it when needed.

Filter by
Sorted by
Tagged with
21 votes
5 answers
5k views

I've heard that I should never use Java serialization (Serializable/ObjectInputStream/ObjectOutputStream) because of security. What's the problem?
Stack Exchange Broke The Law's user avatar
1 vote
3 answers
419 views

I need to design a code generator system that produces serialisation/deserialisation libraries for multiple languages running on multiple platforms. Hard Constraints I need this to capture a pre-...
avigt's user avatar
  • 133
4 votes
3 answers
1k views

Serialization and deserialization in .NET applications can be achieved using several libraries, e.g. Newtonsoft.Json System.Text.Json Assuming I'm developing a new application where I want to use ...
Dario's user avatar
  • 1,065
2 votes
2 answers
188 views

The C++ "standard" method for serializing and deserializing a data type is to use streams with the insertion (<<) and extraction (>>) operators. This has some flaws, but it does ...
Patrick Wright's user avatar
3 votes
2 answers
268 views

Is there a reason to encode options like this: { "options":[ { "name":"opt1", "value":"val1", }, { ...
Samuel's user avatar
  • 139
2 votes
1 answer
163 views

I am writing code that will assign entities to transaction. Each transaction has a counterparty entity. Requirements The entities should be (de-)serialisable (from pydantic models into JSON and vice ...
charelf's user avatar
  • 131
11 votes
5 answers
4k views

There is a coding anti-pattern I've noticed (while using .Net). You declare a data class, which is supposed to have a dictionary field (or get/set Property), and lets call it 'Properties', for the ...
Tim Lovell-Smith's user avatar
18 votes
10 answers
7k views

I am wondering if serialization and deserialization of classes should always be treated as an "atomic transaction?" What I mean is, if an error were to occur during the process of ...
Patrick Wright's user avatar
1 vote
3 answers
248 views

For a while now I have been toying with the idea of using source code as a file storage format. My question: How to support format version changes? (loading of older files with structural differences) ...
Reto Höhener's user avatar
1 vote
1 answer
545 views

I am distributing a proprietary library that includes multiple serializable classes (serializable to a file). I want versioning to the serializable classes, i.e. when serializing I put the version ...
wk_j's user avatar
  • 29
1 vote
2 answers
172 views

My first thought was that I'm "serializing" the complex object, but from what I understand that means I'm reducing it down to a string or binary format which could be passed over a network. ...
André Christoffer Andersen's user avatar
0 votes
2 answers
551 views

I know this question has to have been answered in countless ways before, but I would appreciate some help pointing me in the correct direction. I am developing an embedded system that receives "...
Patrick Wright's user avatar
1 vote
1 answer
179 views

I often run data processing/machine learning/filesystem-scanning scripts that can take well over 24 hours to complete. For processes with arbitrarily low memory requirements, I can run without using ...
Max Candocia's user avatar
1 vote
1 answer
969 views

In a pretty big project, I have a hierarchy of objects, let's say: Zone object, which contains Block objects and Connection objects. Mainliy, the Connection object links together several Block objects,...
LoPiTaL's user avatar
  • 121
1 vote
1 answer
646 views

I have a scenario in which an Entity defines an EntityRepresentation that is created from another end. The EntityRepresentation is a value object that implements some logic that should be performed on ...
Antonio Santoro's user avatar
1 vote
2 answers
2k views

To clarify, I'm having to develop a GUI application that stores information about clients (for a course) where one of the fields is the logo of the client. I'm currently using serialization to persist ...
Jack Avante's user avatar
1 vote
1 answer
178 views

I use xjc to compile XSD files to Java Classes, and want to edit/extend them to make them persistable through JPA. I cant figure out what the best "Coupling?" would be and how to organize it,...
Oblivial's user avatar
0 votes
0 answers
103 views

I love gRPC, but I find every step of the protobuf process rather frustrating (particularly in Python). Even though they are structurally similar to data structures composed of lists and dicts, you ...
DeusXMachina's user avatar
2 votes
0 answers
379 views

I'm working on a fairly large c++ project which uses boost's serialization. The issue that I have with the way it is currently organized is that serialization is weaved into the main source code on ...
Glinka's user avatar
  • 129
2 votes
3 answers
319 views

Consider that you've got a POJO that you intend to serialize and send through a socket. You can use whatever serialization strategy you wish (JSON, XML, protobuf, ..., etc) to serialize the actual ...
tgabb's user avatar
  • 131
-3 votes
1 answer
92 views

How to exchange 1T data between multiple processes? Requirements: Data < 1TB. Memory > 1T. Multiple processes (different languages) on the same machine or different machines over network Data ...
Jill Clover's user avatar
3 votes
3 answers
8k views

Had a discussion that i felt i needed some external input on. Normally always use interfaces instead of concrete types (on lists, injectable services and so forth). For example in lists i just pass ...
Base's user avatar
  • 132
2 votes
0 answers
51 views

I had the idea to have a route in my REST API that returns serialized (PHP) helper objects. The client code then can use those objects to format some complex JSON structures for the next request. When ...
Benni's user avatar
  • 121
0 votes
2 answers
138 views

What are the pros/cons of having a serialization function accept a sink: class Foo: def toString(self, stringIOSink): pass def toBytes(self, byteSink): pass versus having the ...
Trent Di's user avatar
0 votes
1 answer
67 views

I have a class of (flat) objects that are going to be passed around between three different parties, each possibly running a different software stack. my_object: item: "string_a" money: ...
ShapeOfMatter's user avatar
7 votes
2 answers
6k views

Problem Say we have a C# class with is serialized to JSON (currently via Newtonsoft's JSON.Net) and stored in a database: public class User { public string authInfo; } If the class definition ...
piojo's user avatar
  • 269
10 votes
3 answers
37k views

I need a textual human readable format which is reasonably compact and version-control friendly to serialize a persistent memory heap. My Bismon system (GPLv3) has such a format (it is textual, human-...
Basile Starynkevitch's user avatar
1 vote
1 answer
2k views

I'm having problem deciding which of these 2 structures to use from my DTOs: Option 1 is: @Data class Lines{ private final Line[] lines; } @Data class Line{ private final String[] specifiers; ...
Bojan Vukasovic's user avatar
2 votes
1 answer
304 views

I have a large number of record types derived from a binary format specification. So far, I've already written a computation expression builder that let’s me read structures from the files easily: ...
Kevin Li's user avatar
  • 145
1 vote
1 answer
289 views

I have a question concerning the "Uncommitted Read" Isolation Level under DB2 DBMS for z/OS. In this article https://www.ibm.com/support/knowledgecenter/en/SSEPEK_11.0.0/perf/src/tpc/...
Monty Burns's user avatar
1 vote
0 answers
265 views

I am using protobuf definitions to define message types. Structure looks like message1 { } message2 { bytes msg1 = 1 } So message2 has a field which is a byte array representation of message1. I ...
Korba's user avatar
  • 111
1 vote
1 answer
199 views

I want to create a dictionary application. One of the design guideline is performance in querying and showing up the definitions of words. I would like some suggestions on two design choices: Which ...
McBear Holden's user avatar
3 votes
2 answers
2k views

I need to implement a rollback system and the memento pattern gets mentioned regularly as a solution to this requirement, but in all cases a single object is used and it works in memory, persistence ...
dabadaba's user avatar
  • 2,266
6 votes
1 answer
7k views

I understand we need it to mark a class whose objects can be serialized, but do we strictly need this for behind the hood logic to work? We could just serialize the object using necessary methods. On ...
Shamim Hafiz - MSFT's user avatar
1 vote
0 answers
2k views

I find the following dilemma often. Suppose you're retrieving Json messages from a database, message bus, event store or whatever, and you need to deserialize each message into the proper type. ...
diegosasw's user avatar
  • 407
2 votes
1 answer
1k views

In C#, what is the difference between Automatic serialization and Customer Serialization? Also what is Reflection? I know this stuff is not simple, if someone can explain in lay man's term, that would ...
JohnThomas568's user avatar
3 votes
3 answers
8k views

I'm wondering what is the proper way to send structures as char array by sockets. At this moment I have somethig like below but it isn't good solution because it causes undefined behavoiur. Is it ...
bielu000's user avatar
  • 351
0 votes
1 answer
179 views

I am creating a Parser assembly in C# to parse a XML structure. I have a XML schema defined for the XML files. Using XSD tool I have created Class structures from XML Schema. The XML has various ...
srajeshnkl's user avatar
2 votes
1 answer
535 views

You can create a data structure such as a Parsing Expression Grammar (PEG) that will be used to parse: string -> object You can then write a function that iterates through the object's properties ...
Lance Pollard's user avatar
3 votes
3 answers
631 views

This might be an X Y problem, but here's my situation. I've got a QT5 C++ code base whose task it is to allow for the configuration of a "process chain". A "process chain" here means a list of ...
Krupip's user avatar
  • 1,347
0 votes
1 answer
116 views

Java provides methods for saving data permanently. An object that has to be saved has to implement the interface Serializable. But there is one problem with Java's object serialization: The objects ...
Henry Weinert's user avatar
2 votes
2 answers
720 views

I apologize in advance for the length of this question; it requires some explanation. I'll try to make it as clear as possible. I am developing and maintaining a mobile app (Xamarin, F#) that ...
cmeeren's user avatar
  • 339
1 vote
1 answer
76 views

I have two applications, first is like starting point and the main app is second one. Whenever i have to do something, i have to login to the App1, provide some details to it, then App1 builds a ...
Vik's user avatar
  • 19
1 vote
0 answers
444 views

In my current Java EE project I've got a quite common task: Load objects from database using Hibernate, transfer them in another object structure (based on a XSD) and serialize it using JAXB. To ...
bish's user avatar
  • 173
0 votes
2 answers
261 views

What are the techniques for C programs which allow easily inspecting the state of the embedded device, through a communication link? For example, for a microcontroller device which communicates with ...
Lou's user avatar
  • 265
2 votes
2 answers
296 views

I'm making a game I have a Replay object that represents all the inputs done by a player to finish a level. It looks like that: class Replay { int replayId; int playerId; int levelId; ...
Winter's user avatar
  • 705
0 votes
1 answer
54 views

I'm converting some code that formerly wrote structs directly into storage, to use serialization. This is because it is pretty annoying having piles of code to unpack structs that were laid out ...
M.M's user avatar
  • 135
5 votes
4 answers
2k views

In the early time, maybe just few line code, But I have see too many repeated and messy codes involve serialize/deserialize interference the main logic. So I try to persuade the team members to wrap a ...
wangdq's user avatar
  • 161
1 vote
2 answers
3k views

Here is a json which comes in the request param. I am constructing a class with getter and setter for accessing the values in json so that I could be able to pass the class object to different methods ...
Tom Taylor's user avatar
1 vote
1 answer
125 views

There is a @Mark Seemann's cite from a conversation which states that an abstraction must never implement IDisposable: I like how @nblumhardt put it almost six years ago: an interface [...] ...
Serhii Shushliapin's user avatar