CodeGym
AI Academy
Promotion
CodeGym University
Learning
Courses
Tasks
Surveys & Quizzes
Games
Help
Schedule
Community
Users
Forum
Chat
Articles
Success stories
Activity
Reviews
Subscriptions
Light theme

Lessons

  • Reviews
  • About us
Start
Start learning
Start learning now
  • My Progress
  • Courses
  • University
  • Quest Map
  • Lessons
  • Collections and Map in JSON

    Kotlin SELF
    Level 48, Lesson 0
    We break down how Kotlin collections are serialized to JSON via kotlinx.serialization: why List and Set turn into arrays [...], how Map<String, V> becomes a JSON object {...}, what happens to non-string keys ( Map<Int, ...> → string keys), and when it is better to choose the List<Entry> format instead of a map. At the end — selection criteria and common integration mistakes.
    Available
  • Annotations @SerialName and @Transient

    Kotlin SELF
    Level 48, Lesson 1
    We break down two key annotations from kotlinx.serialization that help keep your JSON format stable: @SerialName — to bind a Kotlin property name to the required field name in JSON (compatibility with old files and external APIs), and @Transient — to exclude fields from serialization (cache, debugging, temporary values) with a mandatory safe default. Plus: typical mistakes when refactoring and reading “old” JSON.
    Available
  • Serialization of enum and sealed class: discriminator and Ok/Error

    Kotlin SELF
    Level 48, Lesson 2
    We break down how enum and sealed class turn into JSON via kotlinx.serialization: why it is important to pin external values for enum using @SerialName, why polymorphic serialization needs a discriminator ( classDiscriminator), how to lock in Ok/ Error variants as "ok"/ "error", and why JSON may differ when serializing through the base type vs a concrete type.
    Available
  • Custom serializer

    Kotlin SELF
    Level 48, Lesson 3
    We break down why you need a custom serializer in kotlinx.serialization: how to separate the internal representation (for example, Money stored as Long cents) from the external JSON contract (the string "12.34"), how to plug in a serializer via @Serializable( with = ...), what KSerializer<T> consists of ( descriptor, serialize, deserialize ), why it is better not to parse money via Double, and how to write fail-fast parsing with SerializationException.
    Available
  • Cyclic references

    Kotlin SELF
    Level 48, Lesson 4
    We break down why cyclic references in Kotlin’s object model turn JSON serialization into a “graph vs. tree” problem, which commonly leads to errors like StackOverflowError. You’ll learn how to design a cycle-free “storage model” (the id-instead-of-reference strategy), dump state via BudgetDump, and then restore convenient in-memory links with buildState(). Finally, we’ll cover nuances around stable identifiers, one-way models, and the role of @Transient.
    Available
Learn
  • Registration
  • Java Course
  • Help with Tasks
  • Pricing
  • Java Syntax
Community
  • Users
  • Articles
  • Forum
  • Chat
  • Success Stories
  • Activity
  • Affiliate Program
Company
  • About us
  • Contacts
  • Reviews
  • Press Room
  • CodeGym for EDU
  • FAQ
  • Support
CodeGym CodeGym is an online course for learning Java programming from scratch. This course is a perfect way to master Java for beginners. It contains 1200+ tasks with instant verification and an essential scope of Java fundamentals theory. To help you succeed in education, we’ve implemented a set of motivational features: quizzes, coding projects, content about efficient learning, and a Java developer’s career.
Follow us
Interface language
English
Deutsch Español हिन्दी Français Português Polski বাংলা 简体中文 मराठी தமிழ் Italiano Bahasa Indonesia 繁體中文 Nederlands 日本語 한국어 Bulgarian Danish Hungarian Basa Jawa Malay Norwegian Romanian Swedish Telugu Thai Українська Filipino Turkish Azərbaycan Русский Vietnamese
Programmers Are Made, Not Born © 2026 CodeGym
MastercardVisa
Programmers Are Made, Not Born © 2026 CodeGym