aries / net.globalid.aries.utils.json / MoshiJsonManager

MoshiJsonManager

class MoshiJsonManager : JsonManager

Moshi JSON manager

This class implements interface JsonManager for Moshi.

Constructors

<init>

Moshi JSON manager

MoshiJsonManager(agentMessageProvider: JsonAdapterProvider<AgentMessage> = AgentMessageProvider())

Properties

moshi

the Moshi instance

val moshi: Moshi!

Functions

fromJson

fun <T> fromJson(type: Class<T>, value: String): T?

toJson

fun <T> toJson(type: Class<T>, value: T): String

Extension Functions

fromJson

This extension method of JsonManager which reduces boilerplate with converting JSON string to the instance of T.

fun <T> JsonManager.fromJson(value: String): T?

toJson

This extension method of JsonManager which reduces boilerplate with converting value to the JSON string.

fun <T> JsonManager.toJson(value: T): String