Create a Json with multiple tables

json

#1

Hi I have a datatable and a list of datatables have to create a json for this

dt1 and list of(dt2)

Both datatable format:

field_name field_value
a 123
b 456
c 789

json has to be like

“worktasklist”: [
{
“fields” : [
{
“field_name”:“a”,
“field_value”:“123”
},
{
“field_name”:“b”,
“field_value”:“456”
},
{
“field_name”:“c”,
“field_value”:“789”
}
]

“customlist”: [
{“customfields” : [

          {
            "field_name":"x",
            "field_value":"1"
          }, {
            "field_name":"y",
            "field_value":"2"
          }, {
            "field_name":"z",
            "field_value":"3"
          }

]
“customfields” : [

          {
            "field_name":"x",
            "field_value":"1"
          }, {
            "field_name":"y",
            "field_value":"2"
          }, {
            "field_name":"z",
            "field_value":"3"
          }

]
]

Note:
worktasklist is my primary datatable and customfields is the list of datatable

Regards
Abhinav kaushal