-
-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow empty values returned by JSONPath #2043
Labels
Milestone
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I am trying to use
coll.JSONPath
to evaluate a particular key path structure but if for whatever reason the path does not exist, the template generation errors with error:You can test this by running the following gomplate command:
It would be great if JSONPath could support returning empty values when the path is not found, perhaps based on the
missingKey
setting. Some support in favor of adding this capability tocoll.JSONPath
can be seen in this comparison doc of the various different supporting libraries for JSONPath that have support for "empty" return values.It could be as simple as changing this line of code to honor the
missingKey
value https://github.com/hairyhenderson/gomplate/blob/main/coll/jsonpath.go#L53===
Gomplate Version: v4.0.0-pre-2
The text was updated successfully, but these errors were encountered: