Safely producing TOML #1194
-
Hi, I have an input YAML datasource and I'm trying to output a TOML file containing a transformed/subsetted version of that datasource - essentially a different format. I'm trying to work out how to correctly escape my strings. The obvious thing to do would be to use data.ToTOML, but I can't find a way to create an object to pass into that. Any ideas here? Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I am also wondering how this works. |
Beta Was this translation helpful? Give feedback.
-
Hi @ShellWowza, thanks for posting this question. There's an example that's related to what you're looking for in the docs which might help. Internally the $ gomplate -d in=./inputfile.yaml -i '{{ ds "in" | data.ToTOML }}' Why don't you try that out and see if it works for you - and please post back! |
Beta Was this translation helpful? Give feedback.
Hi @ShellWowza, thanks for posting this question.
There's an example that's related to what you're looking for in the docs which might help.
Internally the
ds
/datasource
function will convert from YAML to an internal object representation, so you don't need to parse the YAML at all. Something like this should work:$ gomplate -d in=./inputfile.yaml -i '{{ ds "in" | data.ToTOML }}'
Why don't you try that out and see if it works for you - and please post back!