Skip to content

Overview

Concepts and Principles

Development

Overview

IDEs

API Explorer

Releases

Release Notes

TORO Integrate

Coder Studio

Coder Cloud

Bug Reports

Search

Marshaller Methods

Marshaller Methods are one-liners for converting an object into JSON or XML and vise versa. To view the javadocs go here

These are the different ways of using the marshaller methods:

Info

Marshaller Methods is not exposed as Invoke Step in Coder Studio but can still be used in expression. See GloopMethods for an alternative way of converting objects into JSON or XML

Using Gloovy Step marshaller method using gloovy step

Using Gloov Step marshaller method using gloovy step on coder

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
//Instantiate a new Pet object
def myPet = new Pet( "deer", "bambi" "brown" )

//print myPet object as JSON stirng
println myPet.asJSON()

//print myPet object as XML stirng
println myPet.asXML()

//a JSON String for Pet
String petJSONString = """  
 {
  "kind" : "deer",
  "breed" : "bambi",
  "color" : "brown"
} """

//Converts the JSON String into a Pet object
petJSONString.fromJSON(Pet.class)