NotifyAction - toJson()

Serialize the NotifyAction object to a JSON string.

Table 1. Parameters
Name Type Description
None
Table 2. Returns
Type Description
String A JSON representation of this NotifyAction object.

This example demonstrates serializing a NotifyAction object.

// instantiate notify action
var notifyAction = new SNC.NotifyAction();

// add one or more notify actions
// ...

// and serialize to json
var json = notifyAction.toJson();

This example demonstrates both serializing and deserializing a NotifyAction object.

// instantiate notify action
var notifyAction = new SNC.NotifyAction();

// add a queue
var queue = notifyAction.addQueue();
queue.setName('myQueueName');
queue.setDequeue(false);

// serialize to json
var json = notifyAction.toJson();
gs.log('serialization result: ' + json);

// instantiate a new notify action
var newAction = new SNC.NotifyAction();

// deserialize the json generated above
newAction.fromJson(json);

// serialize the new object and log the result
newJson = newAction.toJson();
gs.log('new serialization result: ' + newJson);
gs.log('the same: ' + (json == newJson));

Output: *** Script: serialization result: {"fClassName":"NotifyAction","fActions":[{"fClassName":"QueueAction","fDequeue":true,"fQueueName":"myQueueName"}]} *** Script: new serialization result: {"fClassName":"NotifyAction","fActions":[{"fClassName":"QueueAction","fDequeue":true,"fQueueName":"myQueueName"}]} *** Script: the same: true