Deserialization part 1
Blog post from Starburst
Deserialization is a complex process where JSON token streams are converted into Java objects, and it is considered more challenging than serialization due to the complexity of Java objects compared to the simplicity of JSON. The article discusses a design approach that resembles a recursive descent parser, where deserializers are defined for all supported Java types, each responsible for processing required fields. The deserialization process involves creating a TypedDeserializer for each type, accepting JSON tokens, and recursively calling new deserializers when encountering new types, ultimately building the Java object from the processed tokens. Simple types like numbers and strings are easier to handle, while collections and records require more sophisticated deserialization strategies, which will be addressed in a follow-up article. The implementation also introduces a stream Collector mechanism to reduce JSON tokens into a single Java object, and the article promises further exploration into handling complex types in subsequent discussions.