Skip to content
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

[Solved] Nested variables #231

Closed
omertal88 opened this issue Feb 21, 2022 · 1 comment
Closed

[Solved] Nested variables #231

omertal88 opened this issue Feb 21, 2022 · 1 comment

Comments

@omertal88
Copy link

omertal88 commented Feb 21, 2022

Hello,

I'm trying to use data dynamically bested on my inputs.
Consider the following json:

{
	"my_item": "item2",
	"items": {
		"item1": {
			"value": "5"
		},
		"item2": {
			"value": "10"
		}
	}
}

I wish to access the right item based on the value of my_item, that is, in this case: item2.value.
I tried {{items.{{my_item}}.value}} but no luck.

Is there another way to achieve this?

Thanks
Omer

@omertal88
Copy link
Author

Nevermind.. I got this to work...
If anyone is interested, use:
"{{ at(at(items, my_item), \"value\") }}"

@omertal88 omertal88 changed the title Nested variables [Solved] Nested variables Feb 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant