Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6794545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:14:05+00:00 2026-05-26T18:14:05+00:00

empData1.groovy def empMap[] = [1:2, 2:2, 3:[1:2,3:3,4:890,A:B], //Map inside Map 4:4, 6:7 ] empData2.groovy

  • 0
empData1.groovy
def empMap[] =
       [1:2,
           2:2,
       3:[1:2,3:3,4:890,A:B],  //Map inside Map
       4:4,
       6:7
      ]


empData2.groovy
def empMap1[] =
       [91:21,
           92:22,
       93:[81:82,83:3,84:890,A:B], ////Map inside Map
       94:4,
       96:7
      ]

emp3.groovy
–
– Q1: how can i build a builder for like empMap/empMap1
– Q2: if i want to do in emp3.grrovy like
empData1.include(empMap1) map data copies to map2

is the same thing is achievavle vis groovy json how ?

is this possible to do

def json = new JsonBuilder()
 def result = json {
      1  2              //build a map with 1 as key 2 value without sinlge quaote is this possible
      3  33             //build a map with 3 as key 33 value without sinlge quaote is this possible
 }

println result

**Answer
def json = new JsonBuilder()
 def result = json {
      '1'    '2'              
      '3'    '33'             
 }

println  result

My output [1:2, 3:33]

but i try to build something like this

def json = new JsonBuilder()
 def result = json {
      '1'    '2'              
      '3'    '33'             
      '4'   (
          '1'   '3'
          '4'   '5'
      )
 }

println  result

it gives me compilation error any clue to resolve it

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:14:05+00:00Added an answer on May 26, 2026 at 6:14 pm

    Anish, I suggest you try this instead to make it compile:

    import groovy.json.JsonBuilder
    
    def json = new JsonBuilder()
    def result = json {
      '1'    '2'              
      '3'    '33'             
      '4'   {
          '1'   '3'
          '4'   '5'
      }
    }
    println  json
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Database in Local server named 'empData' and i want that all
i found a piece of code that use ObservableCollection but they can use list
I have table as follows emp_id, emp_name, emp_address, emp_salary, emp_rating I would like to
I have table as follows emp_id, emp_name, emp_address, emp_salary, emp_rating I would like to
This is a homework problem - so I would appreciate if you could tell
I have a stored Procedure that works fine joining 2 tables together. I needed
Please let me know any thread for creating a step by step SSRS report
I am trying to store Double Value in NSUserDefault But though i am able
This is my EmpData Class: package com.bank; public class EmpData { int id; String
I get this error: a different object with the same identifier value was already

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.