Loading an Object from JSON

  • Load the file into a string
string s = System.IO.File.ReadAllText(@"c:\temp\order.json"); 
  • Convert the JSON string to the OrderPoco
var s = System.IO.File.ReadAllText(@"c:\temp\order.json");
var o = JsonConvert.DeserializeObject<OrderPoco>(s); 
  • Use the existing UpdateOrder method to update the database based on the object we've just read from JSON
var s = System.IO.File.ReadAllText(@"c:\temp\order.json");
var o = JsonConvert.DeserializeObject<OrderPoco>(s);
Demo.UpdateOrder(o); 

Help us improve, Edit this page on GitHub
or email us at info@fireflymigration.com