Deserialization
suggest changeThe JSON can come from a file or a server. This snippet only shows the conversion. JsonConvert is in Newtonsoft.Json.
static void Main(string[] args)
{
string jsonExample; // Has the previous json
Author author = JsonConvert.DeserializeObject<Author>(jsonExample);
}
DeserializeObject<Author> builds an Author by matching JSON names to that type's properties.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents