I'm using a .NET WCF service to return a string that contains a JSON coming from my DB in MongoDB. It works well but when I do a GET I get a Json file with \" instead of simple "
Eg. I get \"id\"
instead of "id"
Here's my code:
string IDeviceService.GetDeviceList()
{
IMongoCollection<BsonDocument> collection = DatabaseManager.DeviceCollection();
string deviceList = string.Empty;
var devices = collection.Find(new BsonDocument()).ToList();
foreach (var device in devices)
{
string json = device.ToString();
deviceList = (deviceList + json);
}
return deviceList;
}
I've tried to do a .Replace("\\", "")
that should do the trick but it doesn't do anything.
Any idea?