public bool ReadJSON() { try { string read = System.IO.File.ReadAllText(ConfigurationManager.ConnectionStrings["MessagesJSON"].ConnectionString); JavaScriptSerializer serializer = new JavaScriptSerializer(); List <Messages> msgJSON = new List <Messages>(); msgJSON = serializer.Deserialize <List <Messages> >(read.ToString()); using (var ctx = new DataModel()) { foreach (var obj in msgJSON) { ctx.Messages.Add(obj); } ctx.SaveChanges(); } return(true); } catch (Exception) { return(false); } }