Hi @Krzysztof Nowicki,
Below is the design which gives expected results:
Firstly, I had set the string variable 'var' as below:
Then used below actions:
Code:
function rithreplcefunc(instr) {
const ri_match = instr.match(/"Extra_Information_on_Label"\s*:\s*"(.*?)"(\s*,\s*"\w+":)/s);
if (ri_match) {
let rigoVal = ri_match[1];
let ri_eg_val = JSON.stringify(rigoVal).slice(1, -1);
return instr.replace(ri_match[0], `"Extra_Information_on_Label": "${ri_eg_val}"${ri_match[2]}`);
}
throw new Error("Hello Rithwik, Extra_Information_on_Label property not found in JSON string.");
}
let ri_dta = workflowContext.actions.Set_variable.inputs.value;
if (!ri_dta || typeof ri_dta !== "string") {
throw new Error("Set_variable.inputs.value is undefined, incorrect, or not a JSON string.");
}
let ri_res = rithreplcefunc(ri_dta);
return ri_res;
Output:
Hope this helps.
If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.