I've got a huge JSON String that I provide to this function. I need to replace some entries as they contain spaces and make my life difficult at a later time (JSON Parser).
Now the first line works flawlessly. The last line, however doesn't. To ensure I have something to be found I tried the index (line 2 and 3). So line 2 provides me a (correct) result, so the String is actually found. Line 3 doesn't (and that's fine).
JSON = JSON.Replace(@"cap type", "CapType");
int index = JSON.IndexOf("planning cycle [M\\u0026S]");
int index2 = JSON.IndexOf("planning cycle [M&S]");
JSON = JSON.Replace(@"planning cycle [M\\u0026S]", "PlanningCycleMS");
My thoughts are going towards escape sequence, like you have "\" instead of "\ for the "[" and "]".
So my question is, what can I do to make line 4 work, or get the result of that string be replaced for all occurrences in my data file?
thx