Groovy Jsonbuilder Nested Array

They are in fact a key-value pair with a string as the key and a javascript array of javascript objects as the value. A closure such as {"blah":"foo"} doesn't makes sense to groovy, and you're going to be constrained by syntactical limitations. Multiple versions of the same artifact are replaced with a single one, following standard Maven resolution rules. There is grails. Better tutorials than I could write have been written about iterating over lists and maps (what I think of as "dictionaries" because I'm more familiar with Python, but are most formally known as an Associative Array): I recommend Working with collections from Groovy's own documentation. End the nested object. groovy with Pretty Print via JsonBuilder #!/usr/bin/env groovy /** * buildJsonState. What works with Groovy's MarkupBuilder class to build XML won't work with JSON. Groovy에서는 java와는 다르게 nested block을 생성할 때 {}만을 사용하면 아래와 같은 오류를 볼 수 있다. If the condition is true it then executes the statements thereafter and stops before. In this case you might often end with code similar to this:. You will need a third area to put the result. Rendering complex collections as JSON in Grails So I have a set of somewhat complex objects I need to render as JSON in Grails for some AJAX calls. TTCC layout format consists of time, thread, category and nested diagnostic context information, hence the name. arrays each groovy jsonbuilder. Use your language's "for each" loop if it has one, otherwise iterate through the collection in order with some other loop. What can you do with JSON TO JAVA CONVERTER ? This tool will help you to convert your JSON String/Data to JAVA Class Object ; To Save and Share this code, use Save and Share button. Only one member in the root object with no array or array with one value is supported". When a try catch block is present in another try block then it is called the nested try catch block. JsonBuilder() contact. writeTo(out);. gt1329a Are you saying you have a JSON string, not the array literal you posted at first? If you have a string of JSON, you can use JSON. Fun fact: As of 2011-12-22, the word "array" does not appear in the Dart spec. 6 ma funziona perfettamente bene in 2. This builder supports the usual builder syntax made of nested method calls and closures, but also some specific aspects of JSON data structures, such as list of values, etc. Try indexing the size and filtering on it. Hope you're clear now. node, sh, echo, ws, stash, etc) to exist, or else the pipeline code won't run. Ask Question 1. It allows GSP pages to be re-used in different context using code like the below: Template t = new GroovyPagesTemplateEngine(). But as it uses the same api to create json as the render method I looked at it anyway. [Mule] Create JSON with Groovy from a payload Mule - payload. * // see declarations below fun result() = html { head. Groovy example source code file (JsonBuilder. This builder supports the usual builder syntax made of nested method calls and closures, but also some specific aspects of JSON data structures, such as list of values, etc. GROOVY-9063 Groovy 2. In that chapter, you learned to create and use array of primitive data types (like: Double, int etc. buildJsonState. Groovy Goodness: Finding Data in Collections Groovy adds several methods to Collection classes to find elements in the collection. 5 jar -- You received this message because you are subscribed to the Google Groups "elasticsearch" group. Both builder do create json but they are, let's say unintuitive, when it it comes to arrays with nested objects. The "bookmark" parameter is created via Extended Choice Parameter plugin and it's always empty after that building process is completed, while other parameters get passed values. Throws: java. Loop over multiple arrays (or lists or tuples or whatever they're called in your language) and display the i th element of each. Objects and arrays can be nested up to 20 levels deep. author: JSON. Following screen shot shows the groovy test steps hierarchy which has been explained above. In my last blog, Java 3D Fun with Groovy, I showed an example of using the Java3d libraries via Groovy. After reviewing the basics of Gson, model annotations and mapping of nested objects, we'll go on to a core feature: mapping of Arrays and Lists. com "Java Source Code Warehouse" project. Snipplr lets your store and share all of your commonly used pieces of code and HTML with other programmers and designers. StreamingMarkupBuilder to produce the XML Returns: This customizer Parameters: closure - The closure that defines the XML. How to print even numbers in Java using while loop. Java Nested Loop Sample Problem 2. [GROOVY-4670] - groovy. The JsonFastParser is a special variant of the JsonParserCharArray and is the fastest parser. Welcome back to another blog post in our Gson series. Sample groovy code to perform the Database Verification is explained in Step 6. Creative Video Blending Merge different video clips together to create unique, eye-catching scenes and effects. Contribute to ylxdzsw/JsonBuilder. elasticsearch. The parameter to StartXxxReturnsTrue is the name of the node to create. Welcome to the Java JSON Example Tutorial. Its swedish characters (åäö) in UTF-8 encoded as ISO8859-1. groovy * Jenkins Job DSL Groovy Script showing how to write & read files to Jenkins Workspace import groovy. JsonBuilder class UserEvent { def start def end def days } class User { def name def events } def u1 = new User(name: 'u1', events: [new UserEvent(start: 0, end:. parse(reader) Since the data is actually just a nested structure, which consists of Maps, Lists and primitive data types, we can use the same API we would use for collections to navigate and change JSON data. 如何在groovy中使用JsonBuilder创建一个数组 - How to create an array with a JsonBuilder in groovy groovy如何使用名称创建数组? - groovy how create array with name? 如何在perl中创建和使用字节数组? - How do I create and use a byte array in perl?. 1905 US BARBER QUARTER 25 CENT COIN,1951 - SILVER WASHINGTON QUARTER - CH BU - CHOICE BRILLIANTLY UNC TONING,1969-S Proof Jefferson Nickel PCGS PR-68, Buy 3 Items, Get Off!!. All of these methods return the JSONBuilder instance, permitting a. The findXXX() methods take a closure and if an element matches the condition defined in the closure we get a result. Loop over multiple arrays (or lists or tuples or whatever they're called in your language) and display the i th element of each. That might come in a later version of the groovy library and does not appear to be available in at least ReadyAPI 2. Both builder do create json but they are, let's say unintuitive, when it it comes to arrays with nested objects. I actually saw this but have no clue on how to define such mapping using the java API. [GROOVY-7169] - Cannot use array if it is assigned twice [GROOVY-7176] - Trait missing as a keyword in Groovy documentation [GROOVY-7181] - Using a memoized closure with inject corrupts the memoization cache [GROOVY-7184] - Problem With Compiler Inconsistency [GROOVY-7186] - Resource Leak in GroovyScriptEngine. I am trying to process json data as string and avoid using serdes since user data may be malformed. arrays each groovy jsonbuilder. And I stumbled on Groovy's default values for Hashes, described here. Concord is a workflow server. But as it uses the same api to create json as the render method I looked at it anyway. counting items in a list [array] returns (what we think) are incorrect counts via groovy. CSV to JSON - array of JSON structures matching your CSV plus JSONLines (MongoDB) mode; CSV to Keyed JSON - Generate JSON with the specified key field as the key value to a structure of the remaining fields, also known as an hash table or associative array. There is grails. * Requires Groovy 1. All of these methods return the JSONBuilder instance, permitting a. BEGIN {split ("Mary had a little lamb", strs, " ") for (el in strs) {print strs [el]}} If elements must be returned in some order, keys must be generated in that order. Java Getting Annotation Attributes Example 0. During value conversion it copies character sub-arrays (a mechanism known as "chopping") and operates on them. Multiple versions of the same artifact are replaced with a single one, following standard Maven resolution rules. 1 Answers if array a conatins 'n' elements and array b conatins 'n-1' elements. groovy) This example Groovy source code file (JsonBuilderTest. ST but I'm at wits end. Examples: import hudson. ), String array, and array of objects. Well, using two classes, JsonBuilder and StreamingJsonBuilder, you can create JSON using a root JSON array Probably. I have a nested hash YAML like: The problem is that we pass an array of commands that get. React Map Array Of Objects Example. overall is a map. toString (); And through the magic of generics it generates compile errors if you try to add an element to an array with a property key or an element to an object without a property name:. Contribute to ylxdzsw/JsonBuilder. That is, the array starts at 1 (the initial value), increments with each step from the previous value by 2 (the increment value), and stops once it reaches (or to avoid exceeding) 9 (the terminator value). Your trusted developer training partner. If the JsonValue is a primitive (string, number, boolean or null), it is immutable so return the same object. This method may be used to iterate over the constants as follows: for (GroovyCompilerScope c : GroovyCompilerScope. It is based on a subset of the JavaScript Programming Language Standard ECMA-262 3rd Edition - December 1999. In Java we can define and populate an array with the following code: String[] s = new String[] { "a", "b" };, but in Groovy. This class works like any other builder class in Groovy (see the Defining data structures as code in Groovy recipe from Chapter 3, Using Groovy Language Features). JsonObject class represents an immutable JSON object value (an unordered collection of zero or more name/value pairs). Here's an example of nested for loop. non-empty groups and segments. This builder supports the usual builder syntax made of nested method calls and closures, but also some specific aspects of JSON data structures, such as list of values, etc. The JsonSlurper class converts these JSON types into corresponding Groovy types. With a bit of Groovy code we can take such a String object and turn it into a List or Map again. getProperties() to convert the Expando into a Map, but this fails for any nested Expandos. AbstractGridFormat gridFormat. Part 1 of this series layed the foundation for some Groovy concepts and what makes the language suitable for data mapping tasks. we don't understand about groovy and values. Make sure the second for loop is nested inside the first. JsonBuilder class UserEvent { def start def end def days } class User { def name def events } def u1 = new User(name: 'u1', events: [new UserEvent(start: 0, end:. Corretto @mmigdol. A JsonArray object can be created by reading JSON data from an input source or it can be built from scratch using an array builder object. It stores the part of the string matched by the part of the regular expression inside the parentheses. xml: As we can see, the. What I am trying to achieve is search for discussion by text match to either the title, text, or one of the votes texts. Your votes will be used in our system to get more good examples. There are array and endArray methods that make and bound array values, and object and endObject methods which make and bound object values. It also provides unmodifiable map view to the JSON object name/value mappings. Remember the Scripts folder? Well you can set your global SoapUI properties to be the folder that you plan on putting on SVN. Groovy Goodness: Creating Root JSON Array With JsonBuilder To create JSON output with Groovy is easy using JsonBuilder and StreamingJsonBuilder. 10 M glass crystal bead curtain fashion luxury Home Living Room Bedroom Decor,FANCL Acne Care washing cream 90g Skin care Acne prevention Japan,D15 Kid Child Flannel Coral Carpet Zebra Autumn Winter Living Room Blanket. http://sloanseaman. Your best option is to convert the String to JSON, then convert both JSON objects to class instances, then compare the instances with the class's equals method. The JsonSlurper class converts these JSON types into corresponding Groovy types. 我们可以通过groovy的json构建器生成一个对象类型的json:def builder = new groovy. JsonBuilder class. getProperties() to convert the Expando into a Map, but this fails for any nested Expandos. The intent of this project is to help you "Learn Java by Example" TM. The update API also support passing a partial document, which will be merged into the existing document (simple recursive merge, inner merging of objects, replacing core "keys/values" and arrays). * This builder supports the usual builder syntax made of nested. json,groovy,jsonbuilder. * class JSONSerializer {def target String getJSON {Closure jsonFormat = {object = {// Set the delegate of buildJSON to ensure that missing methods called thereby are routed to the JSONBuilder buildJSON. Such specifications need all of the Pipeline symbols that might exist at runtime (e. Due to their nested structures, iteration is implemented as a depth first traversal over all non-empty substructures, i. Mirror of Apache Groovy. We can also use nested [] to create list of Arrays. I haven't seen many examples of it used around the interwebs, but setproduct takes two sets (or more importantly, two lists) and produces a list of sets with every permutation of the inputs. As we were only interested in cases where the value was a string, we've made a short script that simply filters out where value is an object. A factory instance can be used to create multiple builder instances with the same configuration. Based on (but not extending) the existing TemplateEngine implementations within Groovy. It contains a list of rows returned from a SQL query. But as it uses the same api to create json as the render method I looked at it anyway. Welcome back to another blog post in our Gson series. This shows usage of a simple build wrapper. This recipe provides an overview of another class introduced in Groovy 1. The example code below shows how to build a JsonArray object that represents the following JSON array:. Simplifying nested loops with Java 8 Lambdas This is just a quick tip for everyone who often has to work with multi dimensional arrays in Java 8 (or newer). JasperReports ships with two JavaBean-compliant data source implementations that can wrap either an array or a collection of JavaBean objects. 1 Answers if array a conatins 'n' elements and array b conatins 'n-1' elements. This method returns a future object if the message supports futures, otherwise, it returns null. Groovy & Grails Tutorial. BEGIN {split ("Mary had a little lamb", strs, " ") for (el in strs) {print strs [el]}} If elements must be returned in some order, keys must be generated in that order. A Map (also known as an associative array, dictionary, table, and hash) is an unordered collection of object references. Let's say I have an array of "Foo" objects, each of which contains a name and an array of "Bar" objects, each of which have a name and a location. It is easy for machines to parse and generate. The destination file encourages the conventional file name Dockerfile but allows any arbitrary file name. 0: Vendor: openSUSE Release: lp152. Groovy - Switch Statement - Sometimes the nested if-else statement is so common and is used so often that an easier statement was designed called the switch statement. However, from functional point of view, a delimited string is the same as a regular list. Java code examples for org. Well, using two classes, JsonBuilder and StreamingJsonBuilder, you can create JSON using a root JSON array Probably. In this post we try to give example on how to print even numbers in java using while loop. The example code below shows how to build a JsonArray object that represents the following JSON array:. React Map Array Of Objects Example. Here is an example TTCCLayout output with the RelativeTimeDateFormat. Funziona in modo dopo l’introduzione di Vantaggio parser. This class functions just like other builder classes. getProperties() to convert the Expando into a Map, but this fails for any nested Expandos. Both builder do create json but they are, let’s say unintuitive, when it it comes to arrays with nested objects. Alpina Casco de Esquí Niños Carat Le Visera Hm Negro Rojo Mate,Womens Oversize Circle Round Lens Hippie Groovy Metal Rim Sunglasses Silver Smok,NRS Ninja PFD Low-Profile Short Torso Life Jacket Paddler Kayak Boat Side Entry. Examples of creating valid JSON through SoapUI test case properties. 4 was the last major release under Pivotal Software's sponsorship which ended in March 2015. The index for a JSON array starts at 0, which is different from the norm for PL/SQL collections (nested tables and arrays start at index value 1). Temporary fork of Groovy's JsonBuilder until Groovy 2. You can vote up the examples you like. I don't want to print inside the for loop, I want to print once out side of it after running the loop. Ask Question 1. Getting Started with JMeter ,Selenium RC,WebDriver This blog comprises of learning to get started with Open source automation tools. For example:. Multiple versions of the same artifact are replaced with a single one, following standard Maven resolution rules. It is easy for humans to read and write. [jira] [Commented] (GROOVY-7853) o. That might come in a later version of the groovy library and does not appear to be available in at least ReadyAPI 2. Hi, I need some help in modifying a JSON string. If you like to stay with Groovy on these nice little devices, here are the instructions to install Groovy. * This builder supports the usual builder syntax made of nested. Most of the popular API and data services use the JSON data format, so we'll learn how it's used to serialize interesting information, and how to use the jq to parse it at the command-line. In the couse of this chapter we will look at the different builders available in groovy. 4) Groovy Test Step(DatabaseVerification): This is the groovy step which will handle the test matching of the response fields with the data obtained from the database. Property Detail @OutputFile final RegularFileProperty destFile The destination file representing the Dockerfile. A factory instance can be used to create multiple builder instances with the same configuration. Dummy employee json data. Groovy는 {}를 사용하면 closure가 될 수 있기 때문이다. In the first case, the first (and only) capturing group remains empty. I'm rewriting a test question from C++ to Java and the almight Sun Developers have decided to make for loops difficult by creating new instances of the variable inside of the for loop that exist in their own little world. My project have got groovy dependency. public class JsonBuilder extends GroovyObjectSupport. The intent of this project is to help you "Learn Java by Example" TM. TCName, testStepList: testStepList)) def. After reviewing the basics of Gson, model annotations and mapping of nested objects, we'll go on to a core feature: mapping of Arrays and Lists. The current character read is 'h' with an int value of 104 Unable to determine the current character, it is not a string, number, array, or object line number 1 index number 2 [ here comes the JSON string ]. Both builder do create json but they are, let’s say unintuitive, when it it comes to arrays with nested objects. Objects and arrays can be nested up to 20 levels deep. This class functions just like other builder classes. valueOf(5) results in onMethodCall(invoker,Integer. Object Builds JSON data. JSONBuilder (grails) is there to provide a DSL. Quick one how can I parse a YAML file with groovy and snakeyaml. getProperties() to convert the Expando into a Map, but this fails for any nested Expandos. Arrays can be nested within arrays to as many levels as your program needs. About this site: The Groovy Web Console is a website for sharing and executing Groovy programming snippets of code! Application deployed on Google App Engine. The general form of this statement is − The general working of this statement is that first a condition is evaluated in the if statement. build json strings with schemas. It will return null if there was a problem in the construction of the JSON text (such as the calls to array were not properly balanced with calls to endArray). If your code is indented, for example in the body of the method of a class, your string will contain the whitespace of the indentation. Array type inside Nested Index - unreadable response. JSON represent object data in the form of key-value pairs. names above in combination with Groovy's array index helps convert dotted request parameter names into nested Maps that the data. The rest of the parameters ("Lemon" , "Kiwi") define the new elements to be added. It is based on a subset of the JavaScript Programming Language Standard ECMA-262 3rd Edition - December 1999. Make sure the second for loop is nested inside the first. If calls are determined to be static at compile-time, you get this method called, but method calls whose receivers are Class can invoke static methods, too (that is, x=Integer. Join Alex Theedom as he covers an array of topics, including how to use both the object model and the streaming model, how to traverse a JSON structure, and how to parse JSON data using the extensive builder APIs. If you observe each element of the array in the JSON strings, you will find that they contain a nested object. 0 was released on January 2, 2007, and Groovy 2. Groovy Unmarshalling JSON to a Specific Object - DZone Big Data Big Data Zone. A factory instance can be used to create multiple builder instances with the same configuration. Groovy Goodness: Finding Data in Collections Groovy adds several methods to Collection classes to find elements in the collection. example, showing successful execution of the example in "Groovy Language Documentation" section "1. The current character read is 'h' with an int value of 104 Unable to determine the current character, it is not a string, number, array, or object line number 1 index number 2 [ here comes the JSON string ]. I realize this a silly question and relates to Groovy vs. each just returns the list it's called upon, collect should be used for events. There is grails. each just returns the list it's called upon, collect should be used for events. End the nested object. JENKINS-25623 Ability to abort/timeout an endless loop of Groovy code not inside any step. The processing of the push operation with modifiers occur in the following order, regardless of the order in which the modifiers appear:. 0 was released on January 2, 2007, and Groovy 2. It is now up to 20x faster than before, and its speed competes and often substantially exceeds popular common JSON parsers circa Jan, 2014. names above in combination with Groovy's array index helps convert dotted request parameter names into nested Maps that the data. Instead, its edges are jagged. First of all, to get the examples of this article up and running, we need to set up our pom. When you wrap up this course, you'll be ready to develop with this essential and powerful API. There are array and endArray methods that make and bound array values, and object and endObject methods which make and bound object values. Solved: I have a project requirement that wants a custom field to be populated by a list of customers in a database table. Additionally, the implementors of Jenkins Pipeline found Groovy to be a solid foundation upon which to build what is now referred to as the "Scripted Pipeline" DSL. React Map Array Of Objects Example. The following is a simple F# sequence expression:. Groovy Support for attribute UI hints In one of my previous posts I showed how we can use Groovy expressions in custom properties of Entity and VO attributes. The former seems to be deprecated (according to the grails documentation). GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together. JsonBuilder. Groovy does not allow to declare and initialize an array with curly brackets (curly brackets are used for. If you like to stay with Groovy on these nice little devices, here are the instructions to install Groovy. The object contains strings with a lot of wrongly encoded characters. You can vote up the examples you like. com is supposed also to support "image/pnt" attachments, but for whatever reason, it never worked when I tried to test it. There is a special case to be considered: when the top node results in an anonymous object or array. Examples of creating valid JSON through SoapUI test case properties. Alan Thompson. groovy with Pretty Print via JsonBuilder #!/usr/bin/env groovy /** * buildJsonState. The class JsonBuilderFactory also contains methods to create JsonArrayBuilder instances. Groovy Servers Pages (or GSP for short) is Grails' view technology. [GROOVY-7169] - Cannot use array if it is assigned twice [GROOVY-7176] - Trait missing as a keyword in Groovy documentation [GROOVY-7181] - Using a memoized closure with inject corrupts the memoization cache [GROOVY-7184] - Problem With Compiler Inconsistency [GROOVY-7186] - Resource Leak in GroovyScriptEngine. Getting Started with JMeter ,Selenium RC,WebDriver This blog comprises of learning to get started with Open source automation tools. The next decision-making statement we will see is the if/else statement. JsonBuilder !. Let's have a look at this quote again. When you wrap up this course, you'll be ready to develop with this essential and powerful API. author: JSON. OK, my NOOB status shows here. It shows your data side by side in a clear, editable treeview and in a code editor. Aug 25, 2019 Loops, Problem Solving comments. NotSerializableException problem, even when the JSON text defines nested containers Work for both map and array containers Support LAX parsing (the most important part, for my situation). Alpina Casco de Esquí Niños Carat Le Visera Hm Negro Rojo Mate,Womens Oversize Circle Round Lens Hippie Groovy Metal Rim Sunglasses Silver Smok,NRS Ninja PFD Low-Profile Short Torso Life Jacket Paddler Kayak Boat Side Entry. "cannot transform JSON document to XML: JSON document contains either more than one member in the root object or an array with more than one value in the root object. utilities" is defined, it will be loaded by the ScriptEngine. Returns: The decoded byte array. But in order to print the elements of a list, we can simply call the List's toString() method (which is implicitly called by a sysout). In languages like Java it’s very normal to see multiple nested for loops and if statements dotted around the place, particularly in pre-Java-8 code. Temporary fork of groovy. Console tips. jsonbuilder Groovy-Konvertiere Objekt in JSON-String import groovy json (3) example array json groovy Eine JSON-Zeichenfolge sicher in ein Objekt umwandeln. The following is a simple F# sequence expression:. Java Getting Annotation Attributes Example 0. But it would be cool, if the values can be evaluated for each usage dynamically at run-time, depending on some context. Examples of creating valid JSON through SoapUI test case properties. com is supposed also to support “image/pnt” attachments, but for whatever reason, it never worked when I tried to test it. Groovy uses the getter or setter method, even if you directly use the name of the field. Completely get away from the java. import grails. Hello, thanks for sharing your concerns. Even if you have extensive programming experience there may be a few groovy-specific items of interest. Such applications may need to generate reports using data they already have available as arrays or collections of in-memory JavaBean objects. JasperReports ships with two JavaBean-compliant data source implementations that can wrap either an array or a collection of JavaBean objects. Groovy Goodness: Creating a Root JSON Array - DZone Java. 我们可以通过groovy的json构建器生成一个对象类型的json:def builder = new groovy. groovy) is included in the DevDaily. If a field should not be changeable define it as final, in this case Groovy will not provide a setter. With these methods we create a String representation of a List or Map object. MongoDB Manual. json {"name. This is where Groovy builders come into play. The former seems to be deprecated (according to the grails documentation). A builder for creating JSON payloads. Hi Tom, I need to Pass String array from Java to PL/SQL and also return array from PL/SQL. toString() method or a for-loop. Console cannot be extended [GROOVY-4950] - ConfigSlurper broken on AppEngine [GROOVY-5009] - Problem dispatching array as argument to a closure [GROOVY-5074] - SwingBuilder never shuts down the default executor service. The JsonFastParser is a special variant of the JsonParserCharArray and is the fastest parser. Actually, that's possible. Join the community to find out what other Atlassian users are discussing, debating and creating. During value conversion it copies character sub-arrays (a mechanism known as "chopping") and operates on them. However, it is not the default. JsonBuilder. Groovy provides a number of helper to get the contents of the file into an array of making it really easy to deal with nested collections, as illustrated in. (header와 body를 가진 html 처럼 closure로 묶는다) "button"처럼 배열을 넣고 싶으면 콤마(,)로 구분해 준다. Contribute to BamaRayne/Echosistant development by creating an account on GitHub. Your votes will be used in our system to get more good examples. Groovy, Grails, and related technologies have seen astounding growth in interest and adoption over the past few years, and with good reason. A trailing comma may appear after the last expression in an array initializer and is ignored. Development Tools & Services Is it possible to create JSON values in Groovy using the default JsonBuilder library to exclude all the null values of an object? Such as what Jackson, ID #4382665. Groovy supports arrays just like in Java. toString() will output [{},{},{},{}] since the primitive class char has no properties (other than class). toString() method or a for-loop. File structure to Json object. It will return null if there was a problem in the construction of the JSON text (such as the calls to array were not properly balanced with calls to endArray). See the working code below: import groovy. First, I looked at the official documentation on the JsonBuilder class. public class GroovyPagesTemplateEngine extends ResourceAwareTemplateEngine. Update array to add elements in the correct position.