JsonDecodingException

Thrown when Json fails to parse the given JSON or to deserialize it into a target type.

The exception message is formatted to include, when available, the character offset, the JSON path to the failing element, a hint with actionable guidance, and a minified excerpt of the original input.

Typical cases include malformed JSON, unexpected tokens, missing required fields, or values that cannot be read for the declared type.

Notes about properties:

  • offset: zero-based character index in the input where the failure was detected, or -1 when the position is unknown.

  • path: JSON path to the element that failed to decode (e.g. $.user.address[0].city), when available.

  • input: the original JSON input (or its minified excerpt in the message). Large inputs are shortened with context around offset. Input is provided on a best-effort basis, so it may be incomplete. Input is only included when JsonConfiguration.exceptionsWithDebugInfo is enabled.

  • hint: optional suggestions for the developer, e.g., enabling certain Json configuration options.

Properties

Link copied to clipboard
expect open val cause: Throwable?
Link copied to clipboard
open override val hint: String?

optional suggestions for the developer that can help fix or diagnose the problem.

Link copied to clipboard

original input or its excerpt.

Link copied to clipboard
open override val message: String
Link copied to clipboard
val offset: Int

zero-based index of the error position in the input, or -1 if unknown.

Link copied to clipboard
val path: String?

JSON path to the failing element when available, or null.

Link copied to clipboard
open override val shortMessage: String

short, human-readable description of the decoding error.