@jw44250 , as mentioned above replace() uses regular expression. If you would notice based on your sample data I have added \w+ for Machine name with word characters. You can change regular expression based on Regular Expression pattern of data before and after JSON.
If you are not able to figure out the regular expression yourself, you will have to provide some sample events of data before and after JSON. (Start and End of JSON can also be used for Regular Expression match).