Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
0answers
8 views

portable hashable string representation of data object

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: ...
2
votes
2answers
1k views

Is there a canonical way to handle JSON data format changes?

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 ...
0
votes
2answers
236 views

JSON without quotes for keys

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-...
0
votes
1answer
168 views

Composite DTO or flattened DTO?

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; ...
1
vote
1answer
57 views

Functional Approaches to Serializing Objects to Variable-length Byte Array Output

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: ...
1
vote
1answer
54 views

Avoidance of Lost Update in DB2 for z/OS

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/...
1
vote
0answers
107 views

What are the “gotchas” of refactoring code that is binary serialized? [closed]

I have a few classes that I have to refactor and my particular concern is that they are marked as Serializable. I know with 100% certainty that these classes are parsed out into a file and read back ...
1
vote
0answers
22 views

Can I add new function for protobuf generated struct

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 ...
1
vote
1answer
42 views

Dictionary Application: Suggestions for serialization format and data structure

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 ...
1
vote
2answers
257 views

Can I use the memento pattern with multiple relationships and persistence?

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 ...
2
votes
1answer
1k views

Do we really need SerializableAttribute?

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 ...
1
vote
0answers
311 views

Strategy to Deserialize Json of Unknown type

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. ...
2
votes
1answer
490 views

Net Automatic Serialization vs Custom Serialization Difference

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 ...
2
votes
3answers
1k views

Proper way to send custom data structures by sockets

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 ...
0
votes
1answer
44 views

Common Design approach when using serialized class from XSD

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 ...
2
votes
1answer
159 views

One data structure to both parse and stringify

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 ...
3
votes
3answers
226 views

How to separate serialization, visualization and computation from GUI editable code objects?

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 ...
0
votes
1answer
84 views

How to serialze data that should be changed outside the program

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 ...
1
vote
2answers
246 views

App/server communication - versioning, JSON vs. binary serialization

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 ...
1
vote
1answer
64 views

efficient Communication in two Apps [closed]

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 ...
1
vote
0answers
172 views

Caluclate needed heap size needed for serialization

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 ...
0
votes
2answers
117 views

Techniques for observing runtime state in C

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 ...
2
votes
2answers
260 views

Object cut in parts for technical reasons : Should it be modelized as 1 or 2 objects?

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; ...
0
votes
1answer
43 views

Ensuring no data is missed in serialization

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 ...
5
votes
4answers
1k views

Do we have to write a wrapper function for few line code?

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 ...
1
vote
2answers
1k views

Best way to invoke 'setter method' for first access and 'getter method' for the rest with “getter setter” pattern?

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 ...
1
vote
1answer
82 views

Are there any cases when an abstraction should inherit ISerializable?

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 [......
2
votes
3answers
1k views

Can I serialize all responses from an API into one generic Response object in C#?

I want to consume the Tumblr API in C#. Every request to the API returns a JSON-encoded object with the same general outline: { "meta": { "status": 200, "msg": "OK" }, "...
2
votes
2answers
1k views

Store conditional expression in database

We have an application that allows users to enter conditionals in the form bound op x op bound2, we store this as a string, and then parse it at runtime to evaluate it. It is a decent amount of work, ...
2
votes
1answer
125 views

Writing a library for accessing persisted DBMS data - what should I pay attention to?

I'm working on this project which, for certain reasons, will need to read the data that's persisted by a DBMS (*). The data is not serialized objects with class information, representation of pointers ...
3
votes
1answer
2k views

Serialize Entity Framework Objects Without Lazy Loading

I have a very specific scenario that I'm not sure is possible to fully support: I have an ASP.NET application that uses Entity Framework 6.3 for it's data management. I also have a generic audit ...
0
votes
2answers
68 views

Use XmlDeserializer in factory method?

I have the following class representing an XML configuration stored in the DB: using System.IO; using System.Xml; using System.Xml.Serialization; [XmlRoot("ModalConfiguration")] public class ...
3
votes
5answers
276 views

Should custom deserialization happen in a constructor or in a static method?

When writing custom deserialization code, what's the better practice: a static method that creates an uninitialised object (e.g. using the default constructor) and then performs deserialization, or a ...
1
vote
1answer
59 views

Consistency for disk write in a model object graph

You're writing an app where the model (as in MVC) is an object graph. Occasionally, you want to save this object graph to disk. What are some best practices to ensure that the write is consistent? (...
1
vote
2answers
863 views

jersey post with a huge payload

I have a requirement to write a POST endpoint where the payload is huge(not normal). In the order 10s of Megabytes. And this endpoint will be accessed by a lot of clients (in the order of 1000s) ...
0
votes
1answer
108 views

Efficient irreversible “serialization”?

Suppose we have a function f that gets a complex (non-flat) object as an input, serializes it, calculates hash of serialization results (e.g. md5) and returns calculated hash. It may use some exiting ...
2
votes
1answer
4k views

XElement.Parse and querying versus serialization (strongly typed objects)

We have a rather large code base that interacts with many SOAP based XML services. Each one of these services makes 1 to n service calls A typical low level web service call looks like this (...
0
votes
2answers
319 views

How to calculate new property for old records efficiently?

Let's say we have classes something like this: public class Item1{ public Guid Id {get; set;} public string Name {get; set;} public decimal Price {get; set;} public int Quantity {get; ...
2
votes
2answers
116 views

When do I prefer a local DB over serialization for local data storage?

I recently started developing a small calendar application, in which I can add and view several calendar entries, which contain several data like name, date, alarm settings and so on. Those values ...
1
vote
1answer
4k views

When we need to serialize an exception

I have been developing in Java since 8 months, and I didn't face a case where I went to serialize an exception, I'm asking because I saw the serialVersionUID and how Eclipse advise to add it ...
4
votes
4answers
229 views

Serializing mutating objects

In our system a media file can have several states: invalid empty uploading ingesting ready… ..depending of the state, information about the media is accessed in different ways. For example: ...
3
votes
5answers
5k views

What is the best way to save data of a C++ Program ? Binary vs JSON serialization

We are implementing a CAD program (in C++, Qt) where we have interdependant classes : The smallest brick is the Pattern, it is just a distribution of points. Then we have Layouts which contain ...
2
votes
4answers
2k views

Is it possible to capture java objects to save them as test resources?

I'm wanting to write unit tests to check that for given database responses, certain objects are create/things are done. The problem I have, is that when mocking the database response, I have to ...
3
votes
2answers
695 views

Can StringBuilder be used to effectively store and manage multiple variables of data?

Using C# I want to create one or more text files to store all the data pertaining to a particular 'Thing' on the same line. I am presently leaning towards StringBuilder as per the following. sb....
2
votes
2answers
178 views

Why do we need namespaces when making XML serialization?

I know this might be a very basic question, but I'm new to XML serialization and spent hours trying to read different pages. PS: this is a programming language independent question.
0
votes
3answers
5k views

How can you easily unit test deserialization to different versions of an object?

I am using the protobuf-net library for serialization/deserialization of messages. Due to the distributed nature of the application some applications will have an older version of the object that is ...
6
votes
1answer
111 views

Optimizing a file type for compare tools

Context: I am developing a visual studio plugin that generates layer diagrams. I want the tool to be able to produce an intermediate output, which is the data representation of what is being rendered ...
0
votes
1answer
90 views

How to periodically serialise object's state and deserialise on initialisation in Python?

We're designing an application that is supposed to monitor a system for certain events, email interested parties to prompt them to take action when relevant and parse their replies. The application ...
-2
votes
1answer
537 views

Best way to control serialisation of posted form data [closed]

I'm working on an ASP.NET MVC project. I have a form that is strongly typed. Is it considered good practice to add serialisation attributes to the same view model to control how the data is serialized ...
2
votes
1answer
683 views

How to improve performance for serializing and deserializing a large object graph?

I have a large object graph in .NET (F# as it happens) that I need to persist to disk and then will load again periodically for use in a calculation. The performance of deserializing is more ...