Masterminds / sprig

Useful template functions for Go templates.
http://masterminds.github.io/sprig/
MIT License
4.25k stars 436 forks source link

How to convert "a b c" string to json ["a","b","c"]? #381

Open apiwoni opened 1 year ago

apiwoni commented 1 year ago

I have been looking into sprig library functions since it is used by Argo Workflows and I am at a loss how to convert simple space-delimited string to JSON array of strings with Sprig library!?

kirides commented 1 year ago

What do you want to do? This seems like a job for

{{ splitList " " .AbcValues | toRawJson}}