Package-level declarations

Main package encapsulating the public API of the library.

Main package encapsulating the public API of the library.

Types

Link copied to clipboard

Exception class thrown if an unexpected character is encountered in the JSON5 input.

Link copied to clipboard
annotation class ClassDiscriminator(val discriminator: String)

Annotation to set the class discriminator of polymorphic base types.

Link copied to clipboard

Type-safe builder to configure the parameters of a custom Json5 instance.

Link copied to clipboard
sealed class DecodingError : InputError

Base class for errors related to the translation of syntactically correct JSON5 input into an object hierarchy.

Link copied to clipboard

Exception class thrown if a specific key is encountered for the second time in the same JSON5 object.

Link copied to clipboard

Exception class thrown if an unexpected end of the input stream is encountered.

Link copied to clipboard
sealed class InputError : Exception

Base class of all Exceptions that the library raises in response to invalid JSON5 input.

Link copied to clipboard
sealed class Json5 : StringFormat

Main interface to serialize a given object hierarchy to JSON5 or vice versa.

Link copied to clipboard

Exception class thrown if an unexpected literal is encountered in the JSON5 input.

Link copied to clipboard

Exception class thrown if a required field of a Kotlin class is missing.

Link copied to clipboard

Exception class thrown if a number in the JSON5 input exceeds the range that the parser is able to handle.

Link copied to clipboard
sealed class ParsingError : InputError

Base class for all errors related to parsing the JSON5 input.

Link copied to clipboard
annotation class SerialComment(val value: String)

Annotation to specify a comment that should be serialized to every JSON5 occurrence of a property.

Link copied to clipboard

Exception class thrown if a specified value in the JSON5 input is not in line with the underlying data model.

Link copied to clipboard

Exception class thrown if a specified object key is not part of the data model.

Functions

Link copied to clipboard
inline fun <T> Json5.decodeFromStream(inputStream: InputStream): T

Convenience function that calls Json5.decodeFromStream with the default serializer for the type.

fun <T> Json5.decodeFromStream(deserializer: DeserializationStrategy<T>, inputStream: InputStream): T

Deserializes the JSON5 input from inputStream using the given deserializer and returns an equivalent object hierarchy.

Link copied to clipboard
inline fun <T> Json5.encodeToStream(value: T, outputStream: OutputStream)

Convenience function that calls Json5.encodeToStream with the default serializer for the type.

fun <T> Json5.encodeToStream(serializer: SerializationStrategy<T>, value: T, outputStream: OutputStream)

Serializes the given value using the given serializer and writes the result to outputStream.

Link copied to clipboard
fun Json5(actions: ConfigBuilder.() -> Unit): Json5

Type-safe builder to create a custom Json5 instance.