Store JSON data into MySQL

Hi,
I want to store some info obtained by JSON into mysql table like this:

I tried a lot of ways but couldn’t do it. Could someone help me execute this task?

Here’s the json file

[
{
“page”: {
“totalItems”: 0,
“skipped”: 0,
“took”: 6,
“maxTake”: 250
},
“items”: [
{
“organization”: {
“id”: “X9JASBYEIR”
},
“contact”: {
“lastActiveUTC”: “2023-09-19T18:47:18.343Z”,
“phoneNumber”: “+5511999999999”,
“profilePictureUrl”: null,
“isOptIn”: true,
“isBlocked”: false,
“scheduledMessages”: ,
“groupIdentifier”: null,
“tags”: ,
“name”: “ClientOneName”,
“id”: “CUWF8e7r3”
},
“channel”: {
“phoneNumber”: “+551139999999”,
“appName”: “nurbhs484r”,
“appId”: “nurbhs484r”,
“channelType”: “WhatsappBroker”,
“platform”: “StarterV1”,
“state”: “Live”,
“name”: “Confraria da Terra”,
“id”: “ZPtaS2YhSEwGf2lz”
},
“sector”: {
“default”: false,
“order”: 10,
“name”: “Sector 1”,
“id”: “ZPtaZGYhSEwGf5pa”
},
“organizationMember”: {
“muted”: false,
“id”: “ZPjf60ANbC-PIz3D”
},
“organizationMembers”: ,
“tags”: [
{
“name”: “Pre”,
“id”: “ZPsymGYhSEwGQqvK”
}
],
“lastMessage”: {
“prefix”: null,
“headerContent”: null,
“content”: “Transfered”,
“footer”: null,
“file”: null,
“thumbnail”: null,
“contacts”: ,
“messageType”: “Text”,
“sentByOrganizationMember”: {
“muted”: false,
“id”: “ZPjf60ANbC-PIz3D”
},
“isPrivate”: true,
“location”: null,
“question”: null,
“source”: “Member”,
“inReplyTo”: null,
“messageState”: “Processing”,
“eventAtUTC”: “2023-09-19T18:47:30.155Z”,
“chat”: {
“id”: “ZQnsdf5K4rb61hIW”
},
“fromContact”: null,
“templateId”: null,
“buttons”: ,
“botInstance”: null,
“forwardedFrom”: null,
“scheduledMessage”: null,
“bulkSendSession”: null,
“id”: “ZQnswrkGs-IgBFzY”,
“createdAtUTC”: “2023-09-19T18:47:30.155Z”
},
“redactReason”: null,
“open”: true,
“private”: false,
“waiting”: true,
“unread”: ,
“closedAtUTC”: null,
“eventAtUTC”: “2023-09-19T18:47:30.155Z”,
“id”: “ZQnsdf5K4rb61hIW”,
“createdAtUTC”: “2023-09-19T18:46:13.698Z”
},
{
“organization”: {
“id”: “ZPivREANbC-PsfwE”
},
“contact”: {
“lastActiveUTC”: “2023-09-19T18:46:55.066Z”,
“phoneNumber”: “+5521999999999”,
“profilePictureUrl”: null,
“isOptIn”: true,
“isBlocked”: false,
“scheduledMessages”: ,
“groupIdentifier”: null,
“tags”: ,
“name”: “Mirian”,
“id”: “ZQnnHP5K4rb603gU”
},
“channel”: {
“phoneNumber”: “+55129999999”,
“appName”: “q3u6scvp7r”,
“appId”: “q3u6scvp7r”,
“channelType”: “WhatsappBroker”,
“platform”: “StarterV1”,
“state”: “Live”,
“name”: “Central”,
“id”: “ZPslpC5QD34OPxvl”
},
“sector”: {
“default”: false,
“order”: 5,
“name”: “FM”,
“id”: “ZPsqQGYhSEwGMxYG”
},
“organizationMember”: {
“muted”: false,
“id”: “ZPjf60ANbC-PIz3D”
},
“organizationMembers”: [
{
“muted”: false,
“id”: “ZPjf60ANbC-PIz3D”
}
],
“tags”: [
{
“name”: “Humano”,
“id”: “ZPvq1WYhSEwG9eUV”
},
{
“name”: “Possui”,
“id”: “ZPsyqGYhSEwGQsGY”
}
],
“lastMessage”: {
“prefix”: “Emília M.:”,
“headerContent”: null,
“content”: “Text”,
“footer”: null,
“file”: null,
“thumbnail”: null,
“contacts”: ,
“messageType”: “Text”,
“sentByOrganizationMember”: {
“muted”: false,
“id”: “ZPjf60ANbC-PIz3D”
},
“isPrivate”: false,
“location”: null,
“question”: null,
“source”: “Member”,
“inReplyTo”: null,
“messageState”: “Received”,
“eventAtUTC”: “2023-09-19T18:47:20.315Z”,
“chat”: {
“id”: “ZQnnHP5K4rb603gd”
},
“fromContact”: null,
“templateId”: null,
“buttons”: ,
“botInstance”: null,
“forwardedFrom”: null,
“scheduledMessage”: null,
“bulkSendSession”: null,
“id”: “ZQnsuLkGs-IgBEgU”,
“createdAtUTC”: “2023-09-19T18:47:20.315Z”
},
“redactReason”: null,
“open”: true,
“private”: false,
“waiting”: false,
“unread”: ,
“closedAtUTC”: null,
“eventAtUTC”: “2023-09-19T18:47:20.315Z”,
“id”: “ZQnnHP5K4rb603gd”,
“createdAtUTC”: “2023-09-19T18:23:24.566Z”

}
]
}
]

Hi @Matt_RNDI :wave: You could try transforming the JSON data by using something like {{ JSON.stringify($json["body"]) }} and giving that shot - that’s worked before for this user needing something similar!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.