kotlinx.serialization 1.2.0: Faster JSON Handling, Value Classes, API Docs & More

preview_player
Показать описание
The event will feature a live Q&A session with the Kotlin team.
🗓 May 25, 2021 16:00 – 17:30 CEST

00:00 Overview
00:25 Intro
00:33 When do we need serialization?
01:32 Performance upgrades in 1.2.0
02:10 Learning Materials & New API Documentation
03:07 Serializing value classes
04:15 Serializing unsigned integer types
04:55 Alternative Names for JSON fields
05:41 Experimental Protobuf Schema Generator
07:18 Time for feedback
07:27 Summary

We learn about how to transform Kotlin objects to JSON and back faster than ever before, even when using Kotlin Multiplatform – just by upgrading to version 1.2.0! It is up to twice as fast as previous versions when parsing JSON into type-safe Kotlin objects, and turning Kotlin objects into their text representations. The magic behind this performance upgrade? A rewritten JSON decoder (responsible for turning text into Kotlin objects), and a significantly optimized JSON encoder (responsible for turning Kotlin objects into text).

For JSON fields that have different names but the same meaning, for example to maintain backwards compatibility, we explore the new @JsonNames annotation. We see how using it makes it easier to work with services that return differently named fields representing the same values, survive schema migrations, and provide graceful upgrades for applications.

We also explore the all-new API documentation, which has an overhauled design, and symbols that make it easy to navigate through the reference docs.

Support for Protocol Buffers, the binary serialization format from Google, gets expanded, with an experimental schema generator. We learn about the new principles for generating `.proto` files from your Kotlin data classes, which allow us to generate representations of the communication format in other languages, including Python, C++, TypeScript, and many more.

#kotlin #serialization #json #protobuf #libraries #android #jvm #webdev

Рекомендации по теме
Комментарии
Автор

These videos never get boring. Thank you Seb and your team, you are really doing a great job!

GakisStylianos
Автор

This video is awesome. Somewhere between a release announcement and a 5-minute tutorial – perfect for me (who has only used Jackson for my serialization until now).

henninghoefer
Автор

The Github docs are a pleasure to work with. It's super easy to find what I'm looking for or to explore the library. Good job 👍

reach
Автор

This was such a useful video! Thank you!

jessehill
Автор

I was glad about 1.5 already; serialization 1.2 is absolutely icing on the cake; thank you, JetBrains

danielhmorgan
Автор

Love the ProtoBuff Schema generation, great improvements

valour.se
Автор

Json schema generation would also be nice.

noraltavir
Автор

Are there any performance benchmarks for the Kotlin Native version (eg the linuxX64 target) of the KotlinX Serialization library?

pixelPlex
Автор

I plan to replace Gson with kotlinx-serialization in my work project soon.

vitaliiplagov
Автор

Does this update introduce breaking changes for custom format implementations?

raphaeltarita
Автор

Is there a system provided by KotlinX Serialization where one can easily add support for a custom binary serialization format? It is very common in Embedded/IoT development for projects to use a custom binary serialization format.

pixelPlex
Автор

Hold on unsigned numeric data types were already available in Kotlin 1.4.

pixelPlex
Автор

Kotlinx is awsome i have been using it in production however I would love for on feature to be added, if you have a map<string, any> this cannot be json encoded because of multiple types.probably this could be added and to activate it you would need something like a compiler flag.

kamaukenn
Автор

If you type this in you get "unresolved reference: serialization". Mayhaps you forgot to include some information.

boggledorf
visit shbcf.ru