JsonStructureLanguage

class JsonStructureLanguage(json: Json = defaultJson)(source)

Provides utilities for handling JSON structures using Kotlin Serialization. This class facilitates JSON serialization and deserialization with options for custom configurations and pretty-printing.

Constructors

Link copied to clipboard
constructor(json: Json = defaultJson)

Types

Link copied to clipboard
object Companion

Companion object for the JsonStructureLanguage class. Provides shared configurations and utilities for JSON handling and structure definition.

Functions

Link copied to clipboard
inline fun <T> parse(text: String): T

Parses the given JSON string into an object of the specified type.

fun <T> parse(text: String, serializer: KSerializer<T>): T

Parses the given text into an object of type T using the provided serializer.

Link copied to clipboard
inline fun <T> pretty(value: T): String

Converts the given value into a pretty-printed JSON string representation.

fun <T> pretty(value: T, serializer: KSerializer<T>): String

Serializes the given value into a pretty-printed JSON string using the provided serializer.

Link copied to clipboard
inline fun <T> string(value: T): String

Serializes a given value of type T into its JSON string representation using the default serializer.

fun <T> string(value: T, serializer: KSerializer<T>): String

Serializes the given value of type T into its JSON string representation using the specified serializer.