get
Kotlin convenience method to allow expressing JsonPath items in a more succinct way:
val verbosePath = JsonPath.key("key")
.index(0)
.key("sub-key")
val shortPath = JsonPath["key"][0]["sub-key"]
verbosePath == shortPath // trueContent copied to clipboard
Return
a new JsonPath with additional Component.Key added
Parameters
name
The key name used to extract the first item in the json object
Kotlin convenience method to allow expressing JsonPath items in a more succinct way:
val verbosePath = JsonPath.index(1)
.index(0)
.key("sub-key")
val shortPath = JsonPath[1][0]["sub-key"]
verbosePath == shortPath // trueContent copied to clipboard
Return
a new JsonPath with additional Component.Index added
Parameters
index
The index used to extract the first item in the json array