jmespath / jmespath/go-jmespath

Does jmespath support maps?

Open
#96 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
621
Forks
101
PR merge metrics
No merged PRs in 30d

Description

Hello all,
I have this code snippet:

```
fmt.Printf("Hardcoded path value: %v\n", data.Deployments["watchdog"].LivenessProbe.Port)
result, err = jmespath.Search(`"deployments"`, *data)
fmt.Printf("Result 1: %#v err: %v\n", result, err)
result, err = jmespath.Search(`"deployments"."watchdog"`, *data)
fmt.Printf("Result 2: %#v err: %v\n", result, err)
```

The results are:

```
Hardcoded path value: 40385
Result 1: map[string]*onechart.Deployment{"watchdog":(*onechart.Deployment)(0xc0004e5040)} err:
Result 2: err:
```

It seems like jmespath is fully able to traverse a struct and get a Field in there, but fails to grab it when this is a map key.

Is this expected? Are there any alternatives?
Regards.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.