I want to find whether a key-value pair exists in a JSON given a key. This key-value pair may not be under root. It's possible embedded deeply in the document. For example:
{"Persons":[
{"Person":
{"name":"john"}
}]
}
and I want to have something like JsonDoc.has("name"), and return true. I search online and find this thread: Java: Json has key/field
Two answers (minimal-json and org.json) both has some functioned called has() or get(), but I looked into their source code, they are both trying to find the key-value under root. So they don't meet my needs.
I can think of traversing the whole json and try to find the key-value, but it seems not efficient.