1
I have the following JSON stored in a String variable:
{"novosPedidos":[],"pedidos":[{"Apagar":" 633.56"}]}
The "Delete" value contains a space which I need to remove.
I tried using the Replace() method but did not get the expected result:
var newJson = json.Replace(":\" ", ":\"");
The newJson "Delete" value remained unchanged (with space).
I also tried using Replace() replacing only space, but it didn’t work:
var newJson = json.Replace(" ", "");
I auditioned for Ideone: https://ideone.com/W6rAqE
I copied EXACTLY the Original JSON and a strange character appeared in place of space. I could not identify anything. How to solve?
Here is working https://ideone.com/ddaSu6.
– Andre
I copied the String straight from the original JSON and ran a test on Ideone. The funny thing that there instead of being showing an empty space, is a "point" highlighted. Is that some kind of break? https://ideone.com/W6rAqE
– felipearon
Because it does not use the
var newJson = json.Replace(" ", "");
?– CypherPotato
Cypher, see the example here that I set up - https://ideone.com/W6rAqE for some reason some strange special character that I can’t identify. Ali is not really containing space...
– felipearon