Page MenuHomeFeedback Tracker

Add BaseSerializationContext write and read behavior for null objects
Closed, ResolvedPublic

Description

Currently (0.9.8.50) write and read of null instances is not supported and simply aborts the serializer process. Instead, I propose this:

For JSON write null objects as per specification {"nullableField": null}. On read check for if null and if so skip trying to read sub keys.

For BINARY instead of no data there must be a special maybe one byte sequence to indicate NODATA. This could be as simple as as single 0x00 byte. In the c++ code for loading it checks if the ReadValue out param is of type Class and if so peeks one byte (if the stream has at least one byte remaining). If the byte is 0x00 consume it and return true from read and set out value to null. If the peek was something different than 0x00 then continue to read as normally. I am not sure if there could maybe be a conflict if the Class starts with one integer serialization die to number variable or string of length 0, so maybe there needs to be a different byte sequence that cold never exist in normal user data. Or alternative there is always one byte in the stream before a complex object to indicate null or not - but that would bloat up file sizes a little.

Details

Severity
Minor
Resolution
Open
Reproducibility
N/A
Operating System
Windows 10 x64
Category
General

Event Timeline

Arkensor created this task.May 3 2023, 2:28 PM
Geez changed the task status from New to Assigned.May 4 2023, 9:52 AM
Geez closed this task as Resolved.May 15 2023, 12:00 PM
Geez claimed this task.
Geez added a subscriber: Geez.

Resolved for one of the future updates.