Skip to content

Home

Development

IDEs

JAR services

API Explorer

MarshallerFunctions

The Marshaller class contains functions for reading and writing objects to and from XML or JSON.

For Groovy

The functions in this class are intended for use in Groovy, but you may still use them in Gloop using a Groovy script step and set expressions. A better class to use in Gloop is JsonFunctions.

GloopFunctions

Alternatively, you can use functions from GloopFunctions, JsonFunctions, and XmlFunctions to help you create Gloop objects from XML or JSON and vice versa.

Below shows a couple of examples using this class's functions:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
// Create object
def bambi = new Deer( "Bambi", "Mule deer" )

// Create JSON string from object
def bambiJsonString = bambi.asJSON()

// Create XML string from object
def bambiXmString = bambi.asXML()

// Re-create the Deer object from the JSON string above
def parsedBambi = bambiJsonString.fromJSON(Deer.class)