I Use JsonConvert to serialize an object and save it in a database.
This is a sample of the serialized string that I saved in database:
[{"matId":
You have to use JsonConvert.Deserialize method.
Your json string is wrapped within square brackets ([]), hence it is interpreted as array. Therefore, you need to deserialize it to type collection of one class, for example let's call it MyClass.
public class MyClass
{
public int matId { get; set; }
public int value { get; set; }
}
Here is Deserialize method.
var results=JsonConvert.DeserializeObject<List<MyClass>>(json);
Backslashes represent serialized object. You need to deserialize your List object. You can try using Generics:
public List<T> Deserialize<T>(string path)
{
return JsonConvert.DeserializeObject<List<T>>(path);
}