Paths returns the original GJSON paths for a Result where the Result came from a simple query path that returns an array, like: gjson.Get(json, "friends.#.first") The returned value will be in the form of a JSON array: ["friends.0.first","friends.1.first","friends.2.first"] The param 'json' mu
(json string)
| 3432 | // when the Result came from a path that contained a multipath, modifier, |
| 3433 | // or a nested query. |
| 3434 | func (t Result) Paths(json string) []string { |
| 3435 | if t.Indexes == nil { |
| 3436 | return nil |
| 3437 | } |
| 3438 | paths := make([]string, 0, len(t.Indexes)) |
| 3439 | t.ForEach(func(_, value Result) bool { |
| 3440 | paths = append(paths, value.Path(json)) |
| 3441 | return true |
| 3442 | }) |
| 3443 | if len(paths) != len(t.Indexes) { |
| 3444 | return nil |
| 3445 | } |
| 3446 | return paths |
| 3447 | } |
| 3448 | |
| 3449 | // Path returns the original GJSON path for a Result where the Result came |
| 3450 | // from a simple path that returns a single value, like: |