Maybe your string gives you an error like below when you use dynamic content in JSON code:
Invalid JSON. A comma character ‘,’ was expected in scope ‘Object’. Every two elements in an array and properties of an object must be separated by commas
This happens because of the ‘ character in the string like the following sentence example:
Bob stole Billy’s candy bar
Instead you must use a replace expression to replace the apostrophe in the string with \’ like so:
replace('Bob stole Billy's candy bar', '''', '\''')
Double apostrophe (”) means single apostrophe (‘) when enclosed with apostrophes (””) (say that 5 times fast)
the \ symbol is an escape character meaning you want the code to ignore special characters after it.