I have a set of 3 JSON files which have an identical lay out. The number is expected to be much more when I push code into production, I only use 3 to keep the workflow fast.
The JSON files are structured like this
{
"results": [
{
"engagement": {
"id": 2342,
"portalId": 23423,
"active": true,
"createdAt": 1661855667536,
"lastUpdated": 1661935264761,
"modifiedBy": 3453
},
"associations": {
"contactIds": [
00000
],
"companyIds": [],
"dealIds": []
},
"attachments": [],
"scheduledTasks": [],
"metadata": {
"status": "COMPLETED",
"forObjectType": "CONTACT",
"subject": "DEMO"
}
},
],
"hasMore": true,
"offset": 520,
"total": 10523
}
There could be up to 250 records in the 'Results' header, starting with 'engagement'.
I am trying to find a way to merge all 3 JSON files, with Python, where I contain only the data in "results" and drop the rest.
So far I am able to either add all 3 JSON's together but they are still separated by the different "results" headers or the last JSON overwrites the previously made file and I am no further.
The expected results would look like this:
[
{
"engagement": {
"id": 2342,
"portalId": 23423,
"active": true,
"createdAt": 1661855667536,
"lastUpdated": 1661935264761,
"modifiedBy": 3453
},
"associations": {
"contactIds": [
00000
],
"companyIds": [],
"dealIds": []
},
"attachments": [],
"scheduledTasks": [],
"metadata": {
"status": "COMPLETED",
"forObjectType": "CONTACT",
"subject": "DEMO"
}
},
],
[
{
"engagement": {
"id": 2342,
"portalId": 23423,
"active": true,
"createdAt": 1661855667536,
"lastUpdated": 1661935264761,
"modifiedBy": 3453
},
"associations": {
"contactIds": [
00000
],
"companyIds": [],
"dealIds": []
},
"attachments": [],
"scheduledTasks": [],
"metadata": {
"status": "COMPLETED",
"forObjectType": "CONTACT",
"subject": "DEMO"
}
},
],
[
{
"engagement": {
"id": 2342,
"portalId": 23423,
"active": true,
"createdAt": 1661855667536,
"lastUpdated": 1661935264761,
"modifiedBy": 3453
},
"associations": {
"contactIds": [
00000
],
"companyIds": [],
"dealIds": []
},
"attachments": [],
"scheduledTasks": [],
"metadata": {
"status": "COMPLETED",
"forObjectType": "CONTACT",
"subject": "DEMO"
}
},
],
Any help will be much appericiated.