json

fun <T : Any> Table.json(name: String, serialize: (T) -> String, deserialize: (String) -> T): Column<T>

Creates a column, with the specified name, for storing JSON data.

Note: This column stores JSON either in non-binary text format or, if the vendor only supports 1 format, the default JSON type format. If JSON must be stored in binary format, and the vendor supports this, please use jsonb() instead.

Parameters

name

Name of the column

serialize

Function that encodes an object of type T to a JSON String

deserialize

Function that decodes a JSON string to an object of type T


inline fun <T : Any> Table.json(name: String, jsonConfig: Json, kSerializer: KSerializer<T> = serializer<T>()): Column<T>

Creates a column, with the specified name, for storing JSON data.

Note: This column stores JSON either in non-binary text format or, if the vendor only supports 1 format, the default JSON type format. If JSON must be stored in binary format, and the vendor supports this, please use jsonb() instead.

Parameters

name

Name of the column

jsonConfig

Configured instance of the Json class

kSerializer

Serializer responsible for the representation of a serial form of type T. Defaults to a generic serializer for type T

Samples

org.jetbrains.exposed.sql.json.JsonColumnTests.testLoggerWithJsonCollections