JsonPrimitive

Class representing JSON primitive value. JSON primitives include numbers, strings, booleans and special null value JsonNull.

Inheritors

Properties

Link copied to clipboard

Returns content of current element as boolean

Link copied to clipboard

Returns content of current element as boolean or null if current element is not a valid representation of boolean

Link copied to clipboard
abstract val content: String

Content of given element without quotes. For JsonNull, this method returns a "null" string. JsonPrimitive.contentOrNull should be used for JsonNull to get a null.

Link copied to clipboard

Content of the given element without quotes or null if current element is JsonNull

Link copied to clipboard

Returns content of current element as double

Link copied to clipboard

Returns content of current element as double or null if current element is not a valid representation of number

Link copied to clipboard

Returns content of current element as float

Link copied to clipboard

Returns content of current element as float or null if current element is not a valid representation of number

Link copied to clipboard

Returns content of the current element as int

Link copied to clipboard

Returns content of the current element as int or null if current element is not a valid representation of number

Link copied to clipboard
abstract val isString: Boolean

Indicates whether the primitive was explicitly constructed from String and whether it should be serialized as one. E.g. JsonPrimitive("42") is represented by a string, while JsonPrimitive(42) is not. These primitives will be serialized as 42 and "42" respectively.

Link copied to clipboard

Convenience method to get current element as JsonArray

Link copied to clipboard

Convenience method to get current element as JsonNull

Link copied to clipboard

Convenience method to get current element as JsonObject

Link copied to clipboard

Convenience method to get current element as JsonPrimitive

Link copied to clipboard

Returns content of current element as long

Link copied to clipboard

Returns content of current element as long or null if current element is not a valid representation of number

Functions

Link copied to clipboard
open override fun toString(): String