2022 Developer Survey is open! Take survey.

Questions tagged [serialization]

Serialization is the process by which an object is converted into a format that can be stored and later retrieved.

Filter by
Sorted by
Tagged with
3 votes
1 answer
96 views

Processing a binary file with buffer length tags

I am trying to process a very large binary file using MappedByteBuffer from java.nio package. This is how the data looks like in the file: ...
user avatar
  • 33
0 votes
1 answer
84 views

Jackson deserialization of subset of enums

I have several enums that all implement this interface: public interface SelectOption { String getId(); String getLabel(); } Here's an example: ...
user avatar
  • 169
2 votes
1 answer
63 views

Multiplayer game byte array serializer with unity

I I'm trying to make an multiplayer game using golang and unity. Golang server side checking units on scene(like a character move). It also sends the information (position, health) of the units on ...
user avatar
  • 23
0 votes
0 answers
27 views

IP socket object with string serialization

I frequently deal with IPv4 and IPv6 endpoints, especially as HTTP URLs. To have the destination address and port available but also be able to easily serialize the socket into URLs, I creates this ...
user avatar
0 votes
0 answers
53 views

Class to save the parameters of every function call

I wrote a function saving class which basically saves data of every function that's being called ...
user avatar
1 vote
0 answers
91 views

Python functions to serialize nested data structures human readably

See Serializing (nested) data structures in a human-readable format for more details. In the last two days I have significantly improved my function, and wrote seven implementations of it. I have ...
user avatar
2 votes
2 answers
87 views

Serializing (nested) data structures in a human-readable format with all bugs fixed

See Serializing (nested) data structures in a human-readable format for more details. This is the latest version, I have fixed all bugs and now this piece of code works completely as intended. And I ...
user avatar
4 votes
2 answers
820 views

Serializing (nested) data structures in a human-readable format

I am reinventing the wheel to write a function that serializes a (nested) data structure human readably. The default output is deliberately similar to that of ...
user avatar
6 votes
4 answers
473 views

Packing and unpacking values in a buffer

I have to deal with raw memory manipulation. For that I wrote a function which stores data one after another, and another function which reads this data and stores it into variables. More precisely: <...
user avatar
  • 225
1 vote
1 answer
57 views

Wanted to eliminate the repetition in the classes created to reduce duplication

Can some one help me on how to eliminate repetition to reduce duplication score on the below classes created in the code ...
user avatar
2 votes
1 answer
69 views

Android app class serialization

I am attempting to build an Android APP with the custom serializable class User. The public method Save is to save class ...
user avatar
  • 3,302
4 votes
3 answers
1k views

De-/Serialization of structs representing TCP messages

I wrote two template functions to serialize and deserialize structs representing messages to be sent and received via a TCP socket: ...
user avatar
8 votes
3 answers
382 views

Sinclair Spectrum TAP file dumper

The other day, I had occasion to want to look into an ancient piece of Z80 software written for a Sinclair Spectrum computer. Software for this machine was typically saved to audio tape, and today ...
user avatar
  • 64.1k
0 votes
1 answer
169 views

Unity Static Singleton JSON Serialisation

I have a static PlayerData singleton which stores all the data for the player (gold, upgrades, heroes etc) but JsonUtility ...
user avatar
4 votes
1 answer
487 views

Struct Serialization using Unsafe Field

I want to use structs as a container for data packets for asynchronous networking in C#. Found out that you can create a union style struct without the need to mark the struct itself as unsafe--...
user avatar
2 votes
2 answers
146 views

Message encode/decode library

I write protocol messages encoder/decoder for my project. All messages have 2-bytes header (1 byte - message type, 1 byte message sub-type) and body. There are two types of messages: Plain message - ...
user avatar
  • 257
7 votes
2 answers
140 views

constexpr Precalculate size of serialized data with templates and C++20 concepts

Im writing a serializer that will do serialization/deserialization as fast as possible, and that uses templates so that i dont have to create a ton of functions for every data structure, This is the ...
user avatar
6 votes
2 answers
163 views

Simplify Generic Method

I am writing a GenericDeserializer for Apache Kafka. My class implements IDeserializer<T> from Confluent.Kafka.Net package....
user avatar
  • 286
5 votes
2 answers
206 views

(de)serializing c++ object almost automagically

Here's one way to solve the serialization problem in c++20, using a json library: ...
user avatar
  • 1,354
3 votes
1 answer
463 views

JSON serializable string enum in C# with generic JsonConverter

How can StringEnumeration be changed in the code below into a generic class, so that ConsensusState wouldn't need the ...
user avatar
  • 191
5 votes
1 answer
312 views

Decoding a JSON dictionary into different Swift classes using Decodable and JSONDecoder

Generally, the approach I've taken is to try calling container.decode from a decodable enum with its associated value returning ...
user avatar
  • 191
1 vote
0 answers
76 views

Custom JsonConverter for class

Note that this is about System.Text.Json, not NewtonSoft. The underlying issue that inspired this example is the problem of using different serialization on a particular property of a particular class ...
user avatar
1 vote
0 answers
223 views

Better way to Read /Write Memory<byte> to/from POCO

I am communicating with a machine that sends/received structured binary data to my netcore service. The machine supplier's new library uses Memory in their library's API. I have written the following ...
user avatar
2 votes
2 answers
296 views

Reading and Storing Integer from Serial Monitor

Description I wanted to understand how integers can be written and stored inside variables without the use of Serial.parseInt(). I couldn't find any code examples about this. Perhaps this is the ...
user avatar
1 vote
1 answer
92 views

Traffic Light which revolves around Serial Communication

Assignment description This is the improved code for a question I've posted earlier. I'd like to receive feedback on an assignment which I'm currently working on. I have to make two traffic lights ...
user avatar
2 votes
1 answer
127 views

Feedback on Traffic Light which revolves around Serial Communication

Assignment description I'd like to receive feedback on an assignment which I'm currently working on. I have to make two traffic lights which allow traffic to run smoothly. I'm using a master Arduino ...
user avatar
1 vote
1 answer
170 views

Serializing object graph to proprietary binary file

I'm creating a class library to read/write .3di files which are binary files describing 3D models for a video game. This review is for the write/serialization process. I've mapped the different ...
user avatar
4 votes
1 answer
233 views

Convenience function to save and load pickle objects

I want to come up with a simple convenience function to save and load pickle objects. A secondary objective is to simply execute the function without the above function. I have come up with two ...
user avatar
  • 53
2 votes
2 answers
84 views

User Management Program

Main Goal My goal is to create a chat app for my company (they are all software developers). I first make a console version and if it is working fine, I will make a GUI version. The program will run ...
user avatar
  • 2,006
3 votes
0 answers
997 views

C# Rest Client Benchmarking

I build a C# Rest Client library / framework. I noticed that it seemed to be significantly faster than RestSharp for GET at least. So, I decided to put together some benchmarks comparing it to other ...
user avatar
3 votes
0 answers
56 views

Getting a list of waypoints assuming that there is a map [closed]

I'm a beginner learning ROS. I'm developing an android application that will control my robot and that includes getting the list of waypoints to display it to my spinner. How do you get the list of ...
user avatar
4 votes
1 answer
677 views

Parse data into an array of structs

I'd had a hard time getting this to work. I’d like to parse a file containing data and copy this data into a struct. The data file (test.dat) looks like this: <...
user avatar
  • 245
4 votes
0 answers
311 views

F# XML Generation in .NET Core: XmlSerializer or XmlProvider

I am working on SEPA XML generator in F#. I developed two solutions that are roughly equivalent, one relies on the XmlSerializer while the other relies on ...
user avatar
  • 1,101
2 votes
1 answer
292 views

An imitation of reading a C Struct from binary file in python 2.7

Preliminary I need to read a binary file constructed by writing a Struct to it with Python. So I decided to write a simple wrapper using ...
user avatar
  • 771
1 vote
1 answer
590 views

Hex string to Base64 in Haskell

This is my take on the first challenge on the cryptopals crypto challenges list. I think that i made it quite simple but i feel like it is possible to optimize it further. Any suggestion? The code: ...
user avatar
1 vote
1 answer
100 views

Async Tcpwriter and Reader

I currently have a class that I want to serialize/deserialize messages sent to this socket. My plan was to use Task.WhenAny() to monitor 2 tasks (Either watch ...
user avatar
  • 79
16 votes
6 answers
2k views

Avoiding repetition when using the "snprintf idiom" to write text

I'm writing a function to stringify a nested struct. I'm using snprintf to pre-calculate how much space I'll need to allocate. The problem is, it's extremely ...
user avatar
1 vote
1 answer
71 views

Sign-up serialization in Python [closed]

I built a small project using Django-Rest-Framework. Please comment on the best practice style for the code below, which will make it simpler. ...
user avatar
2 votes
1 answer
224 views

Deserializing response to correct type

I use this method to get either Customer or Account. The server will determine which type it is. The response will have a property "Type": "Customer" or ...
user avatar
  • 347
2 votes
1 answer
377 views

Converting hex strings to byte arrays and back to hex strings in Java

Here is my attempt at converting hex strings to byte arrays and converting byte arrays to hex strings: net.coderodde.util.ByteStringConverter ...
user avatar
  • 25.3k
2 votes
1 answer
637 views

Indeterminate-length big-endian to little-endian conversion in Python

I have a need to convert wire encoding (big-endian) to little-endian in Python. The conversion needs to happen as a separate function; I am not allowed to change the function that reads the byte ...
user avatar
  • 257
6 votes
1 answer
141 views

Java objects for a network sniffer program

I'm working on a network sniffer program, whose structure uses 3 main classes: Frame Class - One per monitored frame, holds reference to all the other sub frames Parse Class - Holds the hex value of ...
user avatar
  • 289
3 votes
1 answer
225 views

Convert characters to octal, binary, and integer

I have implemented a sample program that converts vector of characters to its integer representation depending on the bit size specified. I was hoping to get some input on how to simplify the sequence....
user avatar
3 votes
0 answers
455 views

Java code to convert BigDecimal to/from .NET decimal

Background In many languages we have built-in data types for representing decimal floating point numbers. In .NET that's decimal, and in Java we have ...
user avatar
6 votes
2 answers
1k views

Unmanaged byte array to managed structure

I have a need to turn byte arrays into various structures. First version: ...
user avatar
3 votes
1 answer
136 views

Settings class implementation

I have a settings.txt file with the following format: ...
user avatar
  • 1,092
2 votes
0 answers
341 views

WebAPI: Async Filtering CSV content + Json/XML Serialization

I am coding a csv file filtering api in ASP.NET Core, which takes a csv file located at a given uri (and retrieved via the query string) convert the content to a collection of records, then apply a ...
user avatar
  • 1,101
2 votes
1 answer
578 views

IEnumerable<T> async serialization

I am building some classes to serialize (in an async / await way) potentially pretty long ...
user avatar
  • 1,101
11 votes
3 answers
2k views

Decoding assembly instructions in a Game Boy disassembler

I am coding a game boy disassembler in C++. The program (simplified here) converts a vector of byte into an assembly instruction and print it. To do so, it iterates through the vector of bytes (char)...
user avatar
  • 121
6 votes
0 answers
208 views

Reading sparse matrix from binary file

I have binary files containing sparse matrices. Their format is: number of rows int length of a row int column index int value float Reading ...
user avatar
  • 161

1
2 3 4 5 6