Is there a utility function like the following in ...
# typescript
Is there a utility function like the following in the available typescript api?
Copy code
pulumi.json.stringify = (obj: JsonValueWithPotentialOutputsToJsonValue) => Output<string>
The return value here is an Output to a json string where the Output has collected all dependencies discovered while walking the passed object (JsonValueWithOutputs) Edit: just use
pulumi.output(obj).apply(uObj => JSON.stringify(uObj))
as output() deeply unwrapps 🎉 thanks pulumi team (lots of complexity is trivialised in the input/output api for us!)
Infact, does
do this itself (ofc without the stringify)
deeply unwrapping nested Input values as necessary
Yes, that works.
pulumi.output(obj).apply(uObj => JSON.stringify(uObj))
I wrote a tiny utility that simplifies the common case of having to put many values into a single stringify. It's easy with pulumi.all, but it's very messy and hard to read. This allows you to add multiple outputs, then stringify using them all.