File tree 1 file changed +20
-1
lines changed 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -221,7 +221,26 @@ val typeId = typeId().withUUIDGenerator { Generators.randomBasedGenerator().gene
221
221
```
222
222
223
223
224
- ### JSON serialization and deserialization
224
+ ### Serialization and deserialization
225
+
226
+ The ids have built-in serialization and deserialization support for Java, Kotlin (kotlinx.serialization), and Jackson.
227
+
228
+
229
+ #### Kotlin (kotlinx.serialization)
230
+
231
+ Both [ Id] and [ RawId] have ` @Serializable ` and can be used with ` kotlinx.serialization ` .
232
+ You need to include the actual serialization dependency in your project.
233
+
234
+ For example, with CBOR:
235
+
236
+ ` include("io.github.microutils:kotlin-serialization-cbor:1.6.3") `
237
+
238
+ ``` kotlin
239
+ val bytes = Cbor .encodeToByteArray<Id <User >>(id)
240
+ val deserialized = Cbor .decodeFromByteArray<Id <User >>(bytes)
241
+ ```
242
+
243
+ #### Jackson
225
244
226
245
The library provides a Jackson module to serialize and deserialize ` Id ` instances.
227
246
You can’t perform that action at this time.
0 commit comments