jsonpath: allow empty paths
This commit is contained in:
parent
5fc81c787b
commit
28a0d68c05
2 changed files with 5 additions and 0 deletions
|
@ -38,6 +38,10 @@ const maxNestingDepth = 6
|
|||
// Get returns substructures of value selected by path.
|
||||
// The result is always non-nil unless path is invalid.
|
||||
func Get(path string, value interface{}) ([]interface{}, bool) {
|
||||
if path == "" {
|
||||
return []interface{}{value}, true
|
||||
}
|
||||
|
||||
p := pathParser{
|
||||
depth: maxNestingDepth,
|
||||
s: path,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue