JSON serialization format implementation, JSON syntax tree data structures with builders for them, and JSON-specific serializers.
(common, js, jvm, native)
Json |
The main entry point to work with JSON serialization. It is typically used by constructing an application-specific instance, with configured json-specific behaviour (configuration constructor parameter) and, if necessary, registered custom serializers (in SerialModule provided by context constructor parameter). Then constructed instance can be used either as regular SerialFormat or StringFormat or for converting objects to JsonElement back and forth. class Json : StringFormat |
(common, js, jvm, native)
JsonArray |
Class representing JSON array, consisting of indexed values, where value is arbitrary JsonElement data class JsonArray : JsonElement, List<JsonElement> |
(common, js, jvm, native)
JsonArrayBuilder |
DSL builder for a JsonArray. To create an instance of builder, use jsonArray. class JsonArrayBuilder |
(common, js, jvm, native)
JsonArraySerializer |
External Serializer object providing SerializationStrategy and DeserializationStrategy for JsonArray. It can only be used by with Json format an its input (JsonInput and JsonOutput). object JsonArraySerializer : KSerializer<JsonArray> |
(common, js, jvm, native)
JsonBuilder |
Builder to conveniently build Json instances. Properties of this builder are directly matched with properties of JsonConfiguration. class JsonBuilder |
(common, js, jvm, native)
JsonConfiguration |
The class responsible for JSON-specific customizable behaviour in Json format. data class JsonConfiguration |
(common, js, jvm, native)
JsonElement |
Class representing single JSON element. Can be JsonPrimitive, JsonArray or JsonObject. sealed class JsonElement |
(common, js, jvm, native)
JsonElementSerializer |
External Serializer object providing SerializationStrategy and DeserializationStrategy for JsonElement. It can only be used by with Json format an its input (JsonInput and JsonOutput). Currently, this hierarchy has no guarantees on descriptor content. object JsonElementSerializer : KSerializer<JsonElement> |
(common, js, jvm, native)
JsonInput |
Decoder used by Json during deserialization. This interface can be used to inject desired behaviour into a serialization process of Json. interface JsonInput : Decoder, CompositeDecoder |
(common, js, jvm, native)
JsonLiteral |
Class representing JSON literals: numbers, booleans and string. Strings are always quoted. class JsonLiteral : JsonPrimitive |
(common, js, jvm, native)
JsonLiteralSerializer |
External Serializer object providing SerializationStrategy and DeserializationStrategy for JsonLiteral. It can only be used by with Json format an its input (JsonInput and JsonOutput). object JsonLiteralSerializer : KSerializer<JsonLiteral> |
(common, js, jvm, native)
JsonNull |
Class representing JSON object JsonNull : JsonPrimitive |
(common, js, jvm, native)
JsonNullSerializer |
External Serializer object providing SerializationStrategy and DeserializationStrategy for JsonNull. It can only be used by with Json format an its input (JsonInput and JsonOutput). object JsonNullSerializer : KSerializer<JsonNull> |
(common, js, jvm, native)
JsonObject |
Class representing JSON object, consisting of name-value pairs, where value is arbitrary JsonElement data class JsonObject : JsonElement, Map<String, JsonElement> |
(common, js, jvm, native)
JsonObjectBuilder |
DSL builder for a JsonObject. To create an instance of builder, use json. class JsonObjectBuilder |
(common, js, jvm, native)
JsonObjectSerializer |
External Serializer object providing SerializationStrategy and DeserializationStrategy for JsonObject. It can only be used by with Json format an its input (JsonInput and JsonOutput). object JsonObjectSerializer : KSerializer<JsonObject> |
(common, js, jvm, native)
JsonOutput |
Encoder used by Json during serialization. This interface can be used to inject desired behaviour into a serialization process of Json. interface JsonOutput : Encoder, CompositeEncoder |
(common, js, jvm, native)
JsonParametricSerializer |
Base class for custom serializers that allows selecting polymorphic serializer without a dedicated class discriminator, on a content basis. abstract class JsonParametricSerializer<T : Any> : KSerializer<T> |
(common, js, jvm, native)
JsonPrimitive |
Class representing JSON primitive value. Can be either JsonLiteral or JsonNull. sealed class JsonPrimitive : JsonElement |
(common, js, jvm, native)
JsonPrimitiveSerializer |
External Serializer object providing SerializationStrategy and DeserializationStrategy for JsonPrimitive. It can only be used by with Json format an its input (JsonInput and JsonOutput). object JsonPrimitiveSerializer : KSerializer<JsonPrimitive> |
(common, js, jvm, native)
JsonTransformingSerializer |
Base class for custom serializers that allows manipulating an abstract JSON representation of the class before serialization or deserialization. abstract class JsonTransformingSerializer<T : Any> : KSerializer<T> |
(common, js, jvm, native)
JsonDecodingException |
Thrown when Json has failed to parse the given JSON string or deserialize it to a target class. class JsonDecodingException : JsonException |
(common, js, jvm, native)
JsonEncodingException |
Thrown when Json has failed to create a JSON string from the given value. class JsonEncodingException : JsonException |
(common, js, jvm, native)
JsonException |
Generic exception indicating a problem with JSON serialization and deserialization. open class JsonException : SerializationException |
(common, js, jvm, native)
boolean |
Convenience method, returns content of current element as Boolean val JsonElement.boolean: Boolean |
(common, js, jvm, native)
booleanOrNull |
Convenience method, returns content of current element as Boolean or val JsonElement.booleanOrNull: Boolean? |
(common, js, jvm, native)
content |
Convenience method, returns content of current element val JsonElement.content: String |
(common, js, jvm, native)
contentOrNull |
Convenience method, returns content of current element or val JsonElement.contentOrNull: String? |
(common, js, jvm, native)
double |
Convenience method, returns content of current element as Double val JsonElement.double: Double |
(common, js, jvm, native)
doubleOrNull |
Convenience method, returns content of current element as Double or val JsonElement.doubleOrNull: Double? |
(common, js, jvm, native)
float |
Convenience method, returns content of current element as Float val JsonElement.float: Float |
(common, js, jvm, native)
floatOrNull |
Convenience method, returns content of current element as Float or val JsonElement.floatOrNull: Float? |
(common, js, jvm, native)
int |
Convenience method, returns content of current element as Int val JsonElement.int: Int |
(common, js, jvm, native)
intOrNull |
Convenience method, returns content of current element as Int or val JsonElement.intOrNull: Int? |
(common, js, jvm, native)
long |
Convenience method, returns content of current element as Long val JsonElement.long: Long |
(common, js, jvm, native)
longOrNull |
Convenience method, returns content of current element as Long or val JsonElement.longOrNull: Long? |
(common, js, jvm, native)
json |
Builds JsonObject with given init builder. fun json(init: JsonObjectBuilder.() -> Unit): JsonObject |
(common, js, jvm, native)
jsonArray |
Builds JsonArray with given init builder. fun jsonArray(init: JsonArrayBuilder.() -> Unit): JsonArray |
(common, js, jvm, native)
JsonPrimitive |
Convenience method to create JsonPrimitive from given boolean.
Returns JsonNull if value is fun JsonPrimitive(value: Boolean?): JsonPrimitive
Convenience method to create JsonPrimitive from given number.
Returns JsonNull if value is fun JsonPrimitive(value: Number?): JsonPrimitive
Convenience method to create JsonPrimitive from given string literal.
Returns JsonNull if value is fun JsonPrimitive(value: String?): JsonPrimitive |