Hi Yowaraj,
You could try using the ToJSON
extension method, like this:
using CMS;
using CMS.DataEngine;
using CMS.OnlineForms;
using DancingGoat.GlobalEvents;
[assembly: RegisterModule(typeof(FormGlobalEventsModule))]
namespace DancingGoat.GlobalEvents
{
public class FormGlobalEventsModule : Module
{
public FormGlobalEventsModule() : base("DancingGoat.FormGlobalEventsModule")
{
}
protected override void OnInit()
{
base.OnInit();
// Register custom events
BizFormItemEvents.Insert.Before += Insert_Before;
}
private void Insert_Before(object sender, BizFormItemEventArgs e)
{
var item = e.Item;
// Sanity check to ensure we actually have a bizform item.
if (item == null)
{
return;
}
var json = item.ToJSON("data", false);
}
}
}
This would produce JSON for an example form on Dancing Goat like this:
{
"data": {
"FormInserted": null,
"FormUpdated": null,
"UserEmail": "liam@test.com",
"UserMessage": "Test",
"DancingGoatMvcContactUsNew_1ID": null,
"UserLastName": "GOLDFINCH",
"UserFirstName": "LIAM"
}
}