getByPath

fun JsonElement.getByPath(path: String): JsonElement?

Traverses this JsonElement using a slash-delimited path (e.g., "a/b/c").

Extension function on JsonElement. Empty segments are ignored. Unlike get, . is not a separator, so this also reaches keys that contain a dot.

Return

the JsonElement at the given path, or null if any key is missing or the path runs into a value that is not an object. A key that is present with a JSON null value is returned as JsonNull.

Parameters

path

a /-separated path of object keys