Hi dhimansourabh...,
Check this example. Now please take its reference and correct your code.
After reading into class object write the code for insert as per your table structure.
Code
C#
protected void OnSave(object sender, EventArgs e)
{
string json = System.IO.File.ReadAllText(Server.MapPath("~/json.json"));
json = json.Substring(1, json.Length - 2);
Root result = Newtonsoft.Json.JsonConvert.DeserializeObject<Root>(json);
// Use the class to insert record in database as per your requirement.
}
public partial class Root
{
public long customEntityId { get; set; }
public string title { get; set; }
public Model Model { get; set; }
public bool publish { get; set; }
public string customEntityDefinitionCode { get; set; }
}
public partial class Model
{
public string shortDescription { get; set; }
public long thumbnailImageAssetId { get; set; }
public int[] categoryIds { get; set; }
public long categoryId { get; set; }
public object testCheckboxList3 { get; set; }
public int[] thumbnailImageAssets { get; set; }
public string testHtml { get; set; }
public long testDocumentId { get; set; }
public long pageId { get; set; }
public long pageDirectoryId { get; set; }
public object pageIds { get; set; }
}
VB.Net
Protected Sub OnSave(ByVal sender As Object, ByVal e As EventArgs)
Dim json As String = System.IO.File.ReadAllText(Server.MapPath("~/json.json"))
json = json.Substring(1, json.Length - 2)
Dim result As Root = Newtonsoft.Json.JsonConvert.DeserializeObject(Of Root)(json)
End Sub
Public Partial Class Root
Public Property customEntityId As Long
Public Property title As String
Public Property Model As Model
Public Property publish As Boolean
Public Property customEntityDefinitionCode As String
End Class
Public Partial Class Model
Public Property shortDescription As String
Public Property thumbnailImageAssetId As Long
Public Property categoryIds As Integer()
Public Property categoryId As Long
Public Property testCheckboxList3 As Object
Public Property thumbnailImageAssets As Integer()
Public Property testHtml As String
Public Property testDocumentId As Long
Public Property pageId As Long
Public Property pageDirectoryId As Long
Public Property pageIds As Object
End Class
Screenshot
Data read into class object