parse

suspend fun <T> parse(structure: StructuredData<T>, content: String): T(source)

Parses the given content string into an instance of the specified type using the provided structured data schema. If the initial parsing fails, attempts to fix the content based on the error and retries parsing.

Return

An instance of the parsed data type.

Parameters

structure

The structured data schema and serializer to use for parsing the content.

content

The string content to parse into the structured data type.

Throws

SerializationException

If parsing fails both initially and after attempting to fix the content.