I used the data set that @Tom created so that your original data is in the desired type/value format. Once in this state, the program I posted started by isolating in a data set the data for the client matching "111111". This data set was then used in the JSON procedure EXPORT statement to include the client "111111" data in the JSON output you specified. The program output pretty much matches the left side JSON output you posted (except for the empty "subData" array at the bottom - which is easy to add). These programs demonstrate how to take the original data to produce what I understand to be what you desire.
PROGRAM OUTPUT:
{
"method": "startautomation",
"methodParameters": [
{
"type": "IS_API_CALL",
"value": "1"
}
],
"automationKey": "oh_rise",
"version": "2.0",
"detail": [
{
"id": null,
"foreignKeyID": null,
"action": "ADD",
"keyValue": null,
"data": [
{
"type": "Agency",
"value": "28"
},
{
"type": "Client",
"value": "111111"
},
{
"type": "Type",
"value": "ohr_initial"
},
{
"type": "Start Date",
"value": "7/29/2022 9:00 AM"
},
{
"type": "End Date",
"value": "7/29/2022 9:00 AM"
},
{
"type": "Duration (hh:mm)",
"value": "0"
},
{
"type": "Diagnosis Treated",
"value": "XXX"
},
{
"type": "NPI",
"value": "1234567890"
},
{
"type": "Completed By",
"value": "88888"
},
{
"type": "Place of Service Code",
"value": "11"
},
{
"type": "Is Telehealth",
"value": "1"
},
{
"type": "Service Track",
"value": ""
},
{
"type": "ProgramProvidingService",
"value": "ohrs"
},
{
"type": "Program Enrollment",
"value": ""
},
{
"type": "Facility Providing Service",
"value": "25"
},
{
"type": "Is Initial Contact?",
"value": "0"
},
{
"type": "Is Crisis",
"value": "0"
},
{
"type": "Discharge Planning",
"value": "0"
},
{
"type": "Activity Type",
"value": "Phone Call"
},
{
"type": "Portal ID",
"value": "de839c8c-1b61-4c68-907f-652c3c99b00a"
}
]
}
]
}
... View more