Question: I am trying to read a MongoDB document looking like this

```
{
"_id":"a770cf8d-a2ec-45a0-8289-b312c6315997"
"foo1":"value of foo1",
"foo2":"value of foo2"
}

```

I am using the C# driver. The problem is that I get the following error: 

```
Cannot deserialize a 'Guid' from BsonType 'Int32'.

```

My C# code looks like this:

```
var myCollection = myDatabase.GetCollection<MyType>(this.collectionName);
List<MyType> myThings = myCollection.Find(Builders<MyType>.Filter.Empty).ToList();

```

MyType looks like this:

```
[DataContract]
public class MyType
{
    [DataMember(Name="_id")]
    [BsonId(IdGenerator = typeof(CombGuidGenerator))]
    public Guid Id { get; set; }

    [DataMember(Name = "foo1")]
    [BsonElement("foo1")]
    public string Foo1{ get; set; }

    [DataMember(Name = "foo2")]
    [BsonElement("foo2")]
    public string Foo2{ get; set; }
}

```

Answer: 
Your nested object keys should be wrapped in double qoutes instead of single, it is better to fix this from backend, here is some simple solution for do it with JS

Angular pipe

```
transform(value: any, args?: any): any {
    // i'm guessing that your data (value) is string
    return typeof value==='string' ? JSON.parse(value.replace(/'/g, '"')) : value;
}

```
you are getting incorrect JSON of CityRating Array from server

here is an workaround
Define the function in your component

```
getJson(x){
  let z = x.replace(/'/g, '"');
  return JSON.parse(z);
}

```

to use in you template

```
<div *ngFor="let city of 
getJson(optCities[0].resultData.Hoteloption[0].CityRating);let i = 
 index; ">
  {{city.Rating}}
</div>

```

the function will return you an vaild JSON Array so your loop will work