
commonMain.at.asitplus.jsonpath.JsonPath.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jsonpath4k-jvm Show documentation
Show all versions of jsonpath4k-jvm Show documentation
Kotlin Multiplatform library for using Json Paths as specified in [RFC9535](https://datatracker.ietf.org/doc/rfc9535/)
The newest version!
package at.asitplus.jsonpath
import at.asitplus.jsonpath.core.JsonPathCompiler
import at.asitplus.jsonpath.core.JsonPathFunctionExtension
import at.asitplus.jsonpath.core.NodeList
import kotlinx.serialization.json.JsonElement
class JsonPath(
jsonPathExpression: String,
compiler: JsonPathCompiler = JsonPathDependencyManager.compiler,
functionExtensionRetriever: (String) -> JsonPathFunctionExtension<*>? = JsonPathDependencyManager.functionExtensionRepository::getExtension
) {
private val query = compiler.compile(
jsonPath = jsonPathExpression,
functionExtensionRetriever = functionExtensionRetriever,
)
fun query(jsonElement: JsonElement): NodeList {
return query.invoke(jsonElement)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy