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.

References:

https://powerusers.microsoft.com/t5/Building-Flows/Help-with-special-characters-in-a-string/m-p/326454#M35204
https://stackoverflow.com/questions/10080208/parsing-json-with-special-characters
https://tomriha.com/how-to-use-string-with-apostrophe-in-power-automate-filter-query/