How To Create A JSON Request With More Than One Array Element?

How To Create A JSON Request With More Than One Array Element?


I am using the postURL functionality. JSON Request body contains more than one array element like shown below,

Original JSON Request Body Format To Be Used:

  "Name": "Hello World",
  "Roles": [
"Profile": "asdf",
"Description": "sent"

This is my code used for creating above JSON request using "map()" functionality,

  myMapData = map();
  myMapData.put("Name", "Hello World");
  myMapData.put("Description", "sent");

//  I used the following code for creating "Roles" array element which i referenced from a blog listed below

// Code For "Roles"

   start_list = List(); 
    start_list = {"node1"};
    end_list = List();
    for each r in start_list
            myMapTemplateRoles = map();
            stringMap = myMapTemplateRoles;

// End Of Code For Roles

myMapData.put("Roles", end_list);

// End Of Code

JSON Request Body Format Obtained using above code:

  "Name": "Hello World",
"Profile": "asdf",
"Description": "sent"
The above "obtained JSON Format" is displayed as Invalid when tested with 
websie below,
When i pass the above "obtained JSON Format" through postUrl,i am getting 
an error "Bad JSON Request". I think extra quotation marks(hi lighted)before and 
after square brackets of "Roles" in JSON Request is creating this error.
I have followed the same steps for creating a map variable then why 
i am getting an invalid JSON Format string while creating through map(). 
Please let me know if there is any problem in my code.

                  Zoho Marketing Automation

                    Zoho SalesIQ Resources

                          Manage your brands on social media

                            Zoho Pagesense Resources

                                  Zoho TeamInbox Resources

                                    Zoho DataPrep Resources

                                      Zoho CRM Plus Resources

                                        Zoho Books Resources

                                          Zoho Subscriptions Resources

                                            Zoho Desk Resources

                                              Zoho Projects Resources

                                                Zoho Sprints Resources

                                                  Qntrl Resources

                                                    Zoho Creator Resources

                                                      Zoho WorkDrive Resources

                                                        Zoho Campaigns Resources

                                                          Zoho CRM Resources

                                                          • CRM Community Learning Series

                                                            CRM Community Learning Series

                                                          • Tips


                                                          • Functions


                                                          • Meetups


                                                          • Kbase


                                                          • Resources


                                                          • Digest


                                                          • CRM Marketplace

                                                            CRM Marketplace

                                                          • MVP Corner

                                                            MVP Corner

                                                          • Word of the Day

                                                            Word of the Day

                                                                Design. Discuss. Deliver.

                                                                Create visually engaging stories with Zoho Show.

                                                                Get Started Now