https://pulumi.com logo
#typescript
Title
# typescript
b

brash-hairdresser-60389

01/19/2023, 9:20 AM
Hello community, I have a single string value returning as a
pulmi.Outuput
, this output is a JSON string I have to split in 3 fields. I tried to use a single
.apply
function from this output and there take the 3 values and assign to external variables but it doesn’t work clearly. I don’t want to call the same
.apply
and the internal
JSON.parse
3 times to have the fields I need, can you suggest a better way to accomplish that from an Output?
e

echoing-dinner-19531

01/19/2023, 11:22 AM
Something like:
Copy code
x = str.apply(str => /* parse and split */)
// x is now an Output<[str, str, str]>
a = x.apply(x => x[0])
b = x.apply(x => x[1])
c = x.apply(x => x[2])
?