Dynamic Json
C# 4 introduces a new type, dynamic . The type is a static type, but an object of type dynamic bypasses static type checking. In most cases, it functions like it has type object . At compile time, an element that is typed as dynamic is assumed to support any operation.
Code example
private void btnDynamic_Click(object sender, RibbonControlEventArgs e) { string employee = @"[ { 'employeeTag': 'VBAOVERALL a complete solution for Office automation', 'employeeDetails': { 'Name': 'John', 'empCode': 'C001', 'Designation': 'Sr Engineer' }, 'DateOfJoining': '2019-05-23T19:10:00' } ]"; dynamic emps = JArray.Parse(employee); dynamic oEmp = emps[0]; string tag = oEmp.employeeTag; Console.WriteLine(tag); // VBAOVERALL a complete solution for Office automation string oName = oEmp.employeeDetails.Name; Console.WriteLine(oName); // John DateTime joiningDate = oEmp.DateOfJoining; Console.WriteLine(joiningDate); }
Please leave your comments or queries under comment section also please do subscribe to out blogs to keep your self upto date.