From 06a45f8a5335561df65f582149778d6bc311ed5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Kravar=C5=A1=C4=8Dan?= Date: Mon, 10 Feb 2025 15:26:09 +0100 Subject: [PATCH] README.md code syntax highlighting --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a54794f..d551714 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ![GitHub Sponsors](https://img.shields.io/github/sponsors/subchannel13) Serialization library that handles circular references and cross module polymorphism with just annotations. -``` +```Kotlin @SerializableClass abstract class BaseClass( @SerializationData val foo: String @@ -32,7 +32,7 @@ Additionally serialization and deserialization work in two stages Serialization works in two stages: packing and serialization proper. Packing stage converts concrete objects to generic maps and lists that can then be serialized to a format of choice. -``` +```Kotlin // Object to serialize val obj = ObjectSample(10) @@ -52,7 +52,7 @@ session.referencedData.forEach { To start serialization you need a fresh instance of `PackingSession` and call `pack` on and an appropriate packer class (generated for `@SerializableClass` annotated class). This will populate the packing session and return the reference of the "root" object. Then you can use those data to create output in the format of choice. This does move require from library user to write that final piece of logic, but that is not as complex as it sounds. Here is an example of `serializationMapper` function for converting packed objects to JSON for Android: -``` +```Kotlin fun serializationMapper(obj: Any, path: String = ""): Any = when(obj) { is Map<*, *> -> JSONArray().apply { put("map")