JsonPath

Starting point of the JsonPath DSL This represents the root of the path you want to define in your JsonElement

Properties

Link copied to clipboard

Extract a List of JsonElement from a JsonElement

Link copied to clipboard
val Traversal<JsonElement, JsonElement>.boolean: Traversal<JsonElement, Boolean>

Extract a Boolean value from a JsonElement

Link copied to clipboard
val Optional<JsonElement, JsonElement>.double: Optional<JsonElement, Double>
val Traversal<JsonElement, JsonElement>.double: Traversal<JsonElement, Double>

Extract a Double value from a JsonElement

Link copied to clipboard
val Traversal<JsonElement, JsonElement>.every: Traversal<JsonElement, JsonElement>

Select every entry in JsonArray and JsonObject

Link copied to clipboard
val Optional<JsonElement, JsonElement>.float: Optional<JsonElement, Float>
val Traversal<JsonElement, JsonElement>.float: Traversal<JsonElement, Float>

Extract a Float value from a JsonElement

Link copied to clipboard
val Optional<JsonElement, JsonElement>.int: Optional<JsonElement, Int>
val Traversal<JsonElement, JsonElement>.int: Traversal<JsonElement, Int>

Extract a Int value from a JsonElement

Link copied to clipboard
val Optional<JsonElement, JsonElement>.long: Optional<JsonElement, Long>
val Traversal<JsonElement, JsonElement>.long: Traversal<JsonElement, Long>

Extract a Long value from a JsonElement

Link copied to clipboard
val Optional<JsonElement, JsonElement>.null: Optional<JsonElement, JsonNull>
val Traversal<JsonElement, JsonElement>.null: Traversal<JsonElement, JsonNull>

Extract null from a JsonElement

Link copied to clipboard
Link copied to clipboard
val Optional<JsonElement, JsonElement>.string: Optional<JsonElement, String>
val Traversal<JsonElement, JsonElement>.string: Traversal<JsonElement, String>

Extract a String value from a JsonElement

Functions

Link copied to clipboard
open override fun all(source: JsonElement, predicate: (focus: JsonElement) -> Boolean): Boolean
Link copied to clipboard
open override fun any(source: JsonElement, predicate: (focus: JsonElement) -> Boolean): Boolean
Link copied to clipboard
fun Optional<JsonElement, JsonElement>.at(name: String): Optional<JsonElement, Option<JsonElement>>
fun Traversal<JsonElement, JsonElement>.at(name: String): Traversal<JsonElement, Option<JsonElement>>

Select a property with a name as an Option. This allows you to erase the value by setting it to None, or allows you to overwrite it by setting a new Some.

Link copied to clipboard
open infix override fun <S1, T1> choice(other: POptional<S1, T1, JsonElement, JsonElement>): POptional<Either<JsonElement, S1>, Either<JsonElement, T1>, JsonElement, JsonElement>
open override fun <U, V> choice(other: PTraversal<U, V, JsonElement, JsonElement>): PTraversal<Either<JsonElement, U>, Either<JsonElement, V>, JsonElement, JsonElement>
Link copied to clipboard
open infix override fun <C, D> compose(other: POptional<in JsonElement, out JsonElement, out C, in D>): POptional<JsonElement, JsonElement, C, D>
open infix override fun <C, D> compose(other: PTraversal<in JsonElement, out JsonElement, out C, in D>): PTraversal<JsonElement, JsonElement, C, D>
Link copied to clipboard
open override fun exists(source: JsonElement, predicate: (focus: JsonElement) -> Boolean): Boolean
Link copied to clipboard
inline fun <A> Optional<JsonElement, JsonElement>.extract(parser: Json = Json.Default): Optional<JsonElement, A>
inline fun <A> Traversal<JsonElement, JsonElement>.extract(parser: Json = Json): Traversal<JsonElement, A>

Extract a value of type A with an implicit KotlinX Serializer

fun <A> Optional<JsonElement, JsonElement>.extract(serializer: KSerializer<A>, json: Json = Json.Default): Optional<JsonElement, A>
fun <A> Traversal<JsonElement, JsonElement>.extract(serializer: KSerializer<A>, parser: Json = Json): Traversal<JsonElement, A>

Extract a value of type A given a KSerializer for A

Link copied to clipboard
fun Optional<JsonElement, JsonElement>.filterIndex(predicate: (index: Int) -> Boolean): Traversal<JsonElement, JsonElement>
fun Traversal<JsonElement, JsonElement>.filterIndex(predicate: (index: Int) -> Boolean): Traversal<JsonElement, JsonElement>

Select an indices out of a JsonArray with the given predicate

Link copied to clipboard
fun Optional<JsonElement, JsonElement>.filterKeys(predicate: (keys: String) -> Boolean): Traversal<JsonElement, JsonElement>
fun Traversal<JsonElement, JsonElement>.filterKeys(predicate: (keys: String) -> Boolean): Traversal<JsonElement, JsonElement>

Select keys out of an JsonObject with the given predicate

Link copied to clipboard
open override fun findOrNull(source: JsonElement, predicate: (focus: JsonElement) -> Boolean): JsonElement?
Link copied to clipboard
open override fun <C> first(): POptional<Pair<JsonElement, C>, Pair<JsonElement, C>, Pair<JsonElement, C>, Pair<JsonElement, C>>
Link copied to clipboard
open override fun firstOrNull(source: JsonElement): JsonElement?
Link copied to clipboard
open override fun fold(initial: JsonElement, combine: (JsonElement, JsonElement) -> JsonElement, source: JsonElement): JsonElement
Link copied to clipboard
open override fun <R> foldMap(initial: R, combine: (R, R) -> R, source: JsonElement, map: (focus: JsonElement) -> R): R
Link copied to clipboard
operator fun Optional<JsonElement, JsonElement>.get(index: Int): Optional<JsonElement, JsonElement>
operator fun Traversal<JsonElement, JsonElement>.get(index: Int): Traversal<JsonElement, JsonElement>

Select an index out of a JsonArray

operator fun Optional<JsonElement, JsonElement>.get(property: String): Optional<JsonElement, JsonElement>
operator fun Traversal<JsonElement, JsonElement>.get(property: String): Traversal<JsonElement, JsonElement>

Select a property out of a JsonObject

operator fun Optional<JsonElement, JsonElement>.get(range: ClosedRange<Int>): Traversal<JsonElement, JsonElement>
operator fun Traversal<JsonElement, JsonElement>.get(range: ClosedRange<Int>): Traversal<JsonElement, JsonElement>

Select all indices from the range out of a JsonArray

Link copied to clipboard
open override fun getAll(source: JsonElement): List<JsonElement>
Link copied to clipboard
open override fun getOrModify(source: JsonElement): Either<JsonElement, JsonElement>
Link copied to clipboard
open override fun getOrNull(source: JsonElement): JsonElement?
Link copied to clipboard
open override fun isEmpty(source: JsonElement): Boolean
Link copied to clipboard
open override fun isNotEmpty(source: JsonElement): Boolean
Link copied to clipboard
open override fun lastOrNull(source: JsonElement): JsonElement?
Link copied to clipboard
open override fun lift(map: (focus: JsonElement) -> JsonElement): (source: JsonElement) -> JsonElement
Link copied to clipboard
open override fun modify(source: JsonElement, map: (focus: JsonElement) -> JsonElement): JsonElement
Link copied to clipboard
open override fun modifyNullable(source: JsonElement, map: (focus: JsonElement) -> JsonElement): JsonElement?
Link copied to clipboard
fun Optional<JsonElement, JsonElement>.path(path: String, fieldDelimiter: String = ".", indexDelimiter: String = "["): Optional<JsonElement, JsonElement>
fun Traversal<JsonElement, JsonElement>.path(path: String, fieldDelimiter: String = ".", indexDelimiter: String = "["): Traversal<JsonElement, JsonElement>

Select path with dot (.) or bracket (i) notation

Link copied to clipboard
fun Optional<JsonElement, JsonElement>.pathEvery(path: String, fieldDelimiter: String = ".", indexDelimiter: String = "["): Traversal<JsonElement, JsonElement>
fun Traversal<JsonElement, JsonElement>.pathEvery(path: String, fieldDelimiter: String = ".", indexDelimiter: String = "["): Traversal<JsonElement, JsonElement>

Select path with multiple results, see selectEvery for the allowed selectors

Link copied to clipboard
open operator override fun <C, D> plus(other: POptional<in JsonElement, out JsonElement, out C, in D>): POptional<JsonElement, JsonElement, C, D>
open operator override fun <C, D> plus(other: PTraversal<in JsonElement, out JsonElement, out C, in D>): PTraversal<JsonElement, JsonElement, C, D>
Link copied to clipboard
open override fun <C> second(): POptional<Pair<C, JsonElement>, Pair<C, JsonElement>, Pair<C, JsonElement>, Pair<C, JsonElement>>
Link copied to clipboard
fun Optional<JsonElement, JsonElement>.select(selector: String): Optional<JsonElement, JsonElement>
fun Traversal<JsonElement, JsonElement>.select(selector: String): Traversal<JsonElement, JsonElement>

Select value at selector. The following syntax is supported for selector:

Link copied to clipboard
fun Optional<JsonElement, JsonElement>.selectEvery(selector: String): Traversal<JsonElement, JsonElement>
fun Traversal<JsonElement, JsonElement>.selectEvery(selector: String): Traversal<JsonElement, JsonElement>

Select values at selector. The following syntax is supported for selector:

Link copied to clipboard
open override fun set(source: JsonElement, focus: JsonElement): JsonElement
Link copied to clipboard
open override fun setNullable(source: JsonElement, b: JsonElement): JsonElement?
Link copied to clipboard
open override fun size(source: JsonElement): Int