New answers tagged serialization
Best practices
0 votes
0 replies
0 views
How to properly serialize raw binary data in C/C++?
No you actually don't. The endianness of the system is irrelevant, the bitwise operations (e.g. bitwise shifting operators and so on) already do the abstraction for you. All you have to define is the ...
Best practices
1 vote
0 replies
0 views
How to properly serialize raw binary data in C/C++?
One big problem with binary serialization is when you have to deal with different endian representations between the serializer and deserializer. In such an environment it almost impossible to just ...
Best practices
0 votes
0 replies
0 views
How to properly serialize raw binary data in C/C++?
What do you mean with "No endian related issues"? Just knowing that you are in a different endian system does not help to deserialize the data. You need to know the sizes and locations of ...
Best practices
2 votes
0 replies
0 views
How to properly serialize raw binary data in C/C++?
First preference for binary serialization is to use some existing library. There are many (like flatbuffers, protobuf, cbor etc.) and tools for these solve most issues with that, generate code for you ...
Best practices
1 vote
0 replies
0 views
How to properly serialize raw binary data in C/C++?
But looks very ugly. I disagree. It looks totally fine and looks are subjective.
Best practices
1 vote
0 replies
0 views
How to properly serialize raw binary data in C/C++?
Serializing raw binary data is an Oxy-Moron. If you are serializing it you are transforming it in some way, while raw binary data is not transformed, so you are just copying what is in memory to some ...
Best practices
7 votes
0 replies
0 views
How to properly serialize raw binary data in C/C++?
My question to you is: Why do you need to do serialization/deserialization yourself? There are many existing libraries good which can handle it for you, that are tried and tested, and will let you ...
0 votes
How to remove null values generated by a jackson custom serializer?
This needs two things now. The member needs to have the annotation @JsonInclude(NON_EMPTY) and the serializer needs to implement: public boolean isEmpty( final SerializerProvider provider, ...
Best practices
1 vote
0 replies
0 views
How to properly serialize raw binary data in C/C++?
It depends really on the use case, even if your struct has padding in it, you can still `memcpy` it. If possible you can also re-order the fields to get rid of (most of) the padding. Why do you want ...
Best practices
1 vote
0 replies
0 views
How to properly serialize raw binary data in C/C++?
serialize to me accomplishes: For byte data consider base64 or the like No endian related issues: Send integer data MSB first. ASCII: Only use a few control codes and ASCII 32-126 FP is converted to ...
Best practices
2 votes
0 replies
0 views
How to properly serialize raw binary data in C/C++?
To my knowledge, there is no preferred method of serialization and deserialization. Most people say to use a library. I prefer using a uint8_t array, copying the data to the array (serializing) or ...
Best practices
1 vote
0 replies
0 views
How to properly serialize raw binary data in C/C++?
memcpy is your guaranteed way to get the behaviour you want and no undefined behaviour. Just do that, even if it looks ugly (honestly, who cares what it looks like?).
Best practices
0 votes
0 replies
0 views
How to properly serialize raw binary data in C/C++?
What compiler are you using? The #pragma is usually compiler specific and not standardized (for packing an array or structure).
Best practices
1 vote
0 replies
0 views
How to properly serialize raw binary data in C/C++?
If the goal is to de-serialize it on the other side, the first approach without any pragmas and attributes will work as long as both sides have the same representation of the structure (that is data ...
Best practices
0 votes
0 replies
0 views
How do I serialize a floating point number?
IEEE754 is indeed pretty commonplace amongst today's CPUs. Not all CPUs exclusively use IEEE754; some have other representations to (e.g. POWER's decimal representation that is also on the chip as ...
Best practices
1 vote
0 replies
0 views
How do I serialize a floating point number?
Interesting point about SNaN vs. QNaN. If you don't unmask the "invalid" FP exception, and aren't checking fenv to see if comparisons caused an invalid exception, you can just leave it. ...
Best practices
1 vote
0 replies
0 views
How do I serialize a floating point number?
Sure, that's why I wrote to build in a static_assert or other similar test. However, I believe you should not spend any more time on that. On the rare occasion that your code is ported to a machine ...
Best practices
3 votes
0 replies
0 views
How do I serialize a floating point number?
I'm sure there are duplicates of this question, but just as a quick answer: Yes, IEEE-754 is standardized enough that a simple memcpy works fine and you only need to worry about endianness. They are ...
Best practices
0 votes
0 replies
0 views
How do I serialize a floating point number?
Well, I also know just two cases where a different floating-point number type is used. But those cases are so marginal...
Best practices
1 vote
0 replies
0 views
How do I serialize a floating point number?
Well, you do say IEEE 754, which is the particular binary format that most computers have come to standardize on. It is not universal, though.
Best practices
2 votes
0 replies
0 views
How do I serialize a floating point number?
The problem of serialization is completely unrelated to CPU presentation. IEEE 754 does not reinterpret anything. It defines binary representation of the floating-point numbers, semantic meaning of ...
0 votes
Save serializable object to registry in .NET?
I can't believe nobody said anything like: you really should be serializing an array of values to an array of keys, the way Windows does Power Policies, for instance: So given a list of your objects ...
6 votes
Accepted
Serialize and deserialize property with dynamically assigned property name based on a type given in an attribute
You would like a way to serialize a model using Json.NET that handles polymorphic properties in the same way that the XmlSerializer can handle polymorphic properties: For each property, the set of ...
2 votes
Serialising and Deserialising a System.Data.DataSet to XML with SQL Server UniqueIdentifier using different .NET versions
Theoretically you could use a bunch of assembly bindings for the relevant types causing an issue, from the deserialization side. But the best bet might be to just chop off the assembly name from the ...
Top 50 recent answers are included
Related Tags
serialization × 33524c# × 10316
java × 7523
json × 6925
xml × 2830
deserialization × 2664
.net × 2445
python × 2265
django × 1786
json.net × 1639
c++ × 1625
php × 1573
jackson × 1387
django-rest-framework × 1374
android × 1197
wcf × 931
javascript × 850
jquery × 801
arrays × 780
xml-serialization × 740
boost × 649
gson × 565
asp.net × 545
scala × 538
ruby-on-rails × 514