You could manually deserialize into your model class, allowing you to rename the json properties into valid C# properties. Here is an example using JSON.NET.
List<Model> list = new List<Model>();
JArray array = JArray.Parse(json);
foreach (JObject item in array)
{
list.Add(new Model() {
Exp = item.Value<DateTime>("_exp"),
Id = item.Value<int>("_id"),
Val = item.Value<string>("$val")
});
}
public class Model
{
public DateTime Exp { get; set; }
public int Id { get; set; }
public string Val { get; set ;}
}
Another alternative would be replacing $val with _val. Property names can start with _ so the other two are valid. This would allow a automatic deserializing into a model. The added quotes and colon would allow it to only target the property names "$val":
so that you don't accidentally replace a property value.
string newJson = json.Replace("\"$val\":", "\"_val\":");
Model[] models = JsonConvert.Deserialize<Model[]>(newJson);
public class Model
{
public string _val { get; set; }
public DateTime _exp { get; set; }
public int _id { get; set; }
}