# Json

![Maven Central](https://img.shields.io/maven-central/v/io.writeopia/writeopia-serialization)

Writeopia comes with a plugin to allow serialization of information. It can be used to export information as json. You can add the library:

```kotlin
implementation("io.writeopia:writeopia-serialization:[version]")
```

This comes with a ready-to-go json implementation based on `kotlinx-serialization-json`. You can use it to have an already configured way to serialize `Document` and other data models of the SDK.
This is a way to encode `Document` as a request in json:

```kotlin
private fun documentToJson(document: Document, json: Json = writeopiaJson): String {
    val request = document.toApi().wrapInRequest()
    return json.encodeToString(request)
}
```