-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
[Question] How to convert string to list or map #16868
Comments
Hi @apparentlymart {"key1":"value1","key2":"value2"} Do you have solution for this scenario? |
Hi @LanceNero, At the moment there is no built-in way to decode a JSON string. There is some discussion about this in #10363, including information about our plans here. In the mean time, it is necessary to pass data into Terraform some other way, such as generating a |
Hi @apparentlymart |
in my code, I use External data source to convert a string to map. e.g: for string like {"key1":"value1","key2":"value2"}
The output would then be "value1". |
@oulydna is spot on, but I thought I would correct a few typos:
If I saved someone 3 minutes, it's worth it 🎉 |
@kism3t this indicates that you don't have |
I run on windows within poweshell. There I have echo command. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Hi there,
Terraform Version
Question
I have a json string, like this:
I can get the key/value pair , but how to convert json string to list or map ?
Currently, I can convert a string to a list, using the split method, but is there a better way?
And how to convert string to map?
Thanks for any help!
The text was updated successfully, but these errors were encountered: