Create Nested-JSON for by parsing the records from database

Hello Bubblers,

I want to create a whole nested JSON at once, when user clicks on event save button.

** “eventName”: “”,**
** “eventDesc”: “”,**
** “subcatId”: ,**
** “recurringFrom”: “”,**
** “recurringUntil”: “”,**
** “isPublic”: ,**
** “isActive”: ,**
** “langCode”: “”,**
** “recurringCode”: “”,**
** “sessionStartTime”: “”,**
** “sessionEndTime”: “”,**
** “sessionWeekdays”: “”,**
** “sessions”: [{**
** “sessionName”: “”,**
** “sessionDesc”: “”,**
** “sessionStartsOn”: “”,**
** “sessionEndsOn”: “”,**
** “isCancelled”: ,**
** “numRegistrations”: ,**
** “numSeats”: ,**
** “sessionChannels”: [{**
** “channelCode”: “”,**
** “channelConfig”: “”**
** }],**

** }],**
** “channels”: [{**
** “channelCode”: “”,**
** “channelLink”: “”,**
** “effectiveFrom”: “”,**
** “effectiveUntil”: “”**
** }]**

So when we user clicks on save button i want to call the API which accepts whole big nested JSON.

I have set 4 different data types to create this json.

So xan someone tell me how can i create whole json at once for reading each and every value for records.

In this screenshot , i tried using custom state of text data type and whenever i create new things i was creating a JSON as well and appending json to the custom state.

And directly merging one JSON with other is what like this.

I tried doing this using both way, buti feel is whenever user want to createa Save button at last, i want to create the whole JSON at last, which will be having all the updated values.

creating a whole JSON at last for each items of channels and session in database is not getting the exact format of array of objects which i posted in the start of the post.

How can i achieve this? I hope i’m able to explain my requirement.

Thank you.

Hey man, maybe you should try “format as text”, you can see the explanation in this forum post.
Format as Text Forum Post

Sorry, but i didn’t understand. How “format as text” will help?

Format as text will loop your data in the format you specify. Format as text is very useful for nested JSON

1 Like

Sure will try…
So you mean to say Do a search for on whole list of DB records and then in format as text
sessions": [{
“sessionName”: “”,
“sessionDesc”: “”,
“sessionStartsOn”: “”,
“sessionEndsOn”: “”,
“isCancelled”: ,
“numRegistrations”: ,

Then it will give me nested JSON for all records…
Is it what you want to say?

let’s say i have this json body and i want to send a list of people from my data base to a json array

In your JSON body, in the api connector should be 1 variable. Example

users: [<user_data>]

this will allow me to input my own data from my app in this user_data variable.

In my app I can then 'Do a search for User’s:format as text

Inside of the format as text, I would use

{“name”: “This User’s name”, “phone”: “This User’s phone”, “dob”: “This User’s dob”}

with a delimiter of ,

You can also nest a format as text within a format as text as well to accomplish a deep nested JSON object.

It’s also worth noting that you will keep your format on one line and not use a line break such as the Enter key or it will break it.

Here is a bad example that will break
{“name”: “This User’s name”,
“phone”: “This User’s phone”,
“dob”: “This User’s dob”}

This is what i was trying.
It is giving me error…

Re-read my last post on this. You’re breaking your array by using line breaks. Also, you should take out ‘[]’ in your format, you should already have that in your api connector as the example i’ve shown u

Okay… sure. let me make changes. I will let you know.

And I’m not sure if you need to have the recurrsive searches as you’ve already searched for what you want. So it should be accessible as This eventSessions sessionStarts on.

This is the current entry of eventSessions in the loop

The way you have it setup, I’m afraid will return and send the same data for each line.

I have made changes. But Still it is giving issue. I’m setting this whole result in a custom state of type text. That custom state should be of list type or just a text.

You still have [] at the beginning and end which is saying each new item is a new array instead of the current one

In your api connector, for your object should be similar.

I have to send this whole JSON in API.

I think i have to set this body in 3-4 parts.

{ “eventName”: “”,
“eventDesc”: “”,
“subcatId”: ,
“recurringFrom”: “”,
“recurringUntil”: “”,
“isPublic”: ,
“isActive”: ,
“langCode”: “”,
“recurringCode”: “”,
“sessionStartTime”: “”,
“sessionEndTime”: “”,
“sessionWeekdays”: “”,
“sessions”: [{
“sessionName”: “”,
“sessionDesc”: “”,
“sessionStartsOn”: “”,
“sessionEndsOn”: “”,
“isCancelled”: ,
“numRegistrations”: ,
“numSeats”: ,
“sessionChannels”: [{
“channelCode”: “”,
“channelConfig”: “”

"channels": [{
    "channelCode": "<channelsChannelCode>",
    "channelLink": "<ChannelLink>",
    "effectiveFrom": "<effectiveFrom>",
    "effectiveUntil": "<effectiveUntil>"


{“sessionStartsOn”:“Dec 12, 2022 10:14 pm”,“sessionEndsOn”:“Dec 12, 2022 11:14 pm”}{“sessionStartsOn”:“Dec 12, 2022 10:14 pm”,“sessionEndsOn”:“Dec 12, 2022 11:14 pm”}{“sessionStartsOn”:“Dec 12, 2022 10:14 pm”,“sessionEndsOn”:“Dec 12, 2022 11:14 pm”}

this is how it is getting created but is it required to set “,” between two objects.

The whole JSON object should be used as 1. And you’ll format your json body in the format as text with all the info including nested objects

Thank you so much for your help.
I want to ask one more thing, in below scenario i want another data type to be part of a session data type then how can we perform do a search for option for that.

As per your last reply , my understanding is we should create the whole BIg JSON in one short, so i got confused over there.
In one of my earlier comment i have posted the structure of whole nested JSON of our API.Can you please guide with that?

Yes. Essentially, it’ll look like this: (i’m going to write my own example so i don’t get tripped up)

Let’s say I want to send some user data, and it has a few nested objects.

In my workflow I’ll add my call. I’ll start by creating a search for users in the user_data variable we created earlier.

Do a search for Users:format as text

Now, inside the format as text might look something like this.

{"user_name": "This Users name", "contact_info": [Do a search for Contact Info:format as text]}

Now let’s take a look at what might be inside this nested format as text

{"phone": "This Contact Infos phone", "email": "This Contact Infos email", "family": [Search for Family:format as text]}

Looks like we stumbled upon yet another nested object, let’s handle it.

{"mom": "This Familys mom", "dad": "This Familys dad", "brother": "This Familys brother"}


Yes… Okay I just realised it.
Thanks a lot. Your solution saved lot of my time.
Just the last thing, why delimiter is not working, I mean when there is array of objects there has to be “,” between two objects.

Don’t add an ending “,”. We can use them throughout our JSON object but leave it off at the end. You’re probably adding 1 too many