NotifyAction - fromJson(String json)

Deserialize a NotifyAction object from a JSON string.

Table 1. Parameters
Name Type Description
json String A JSON string representation of a NotifyAction object.
Table 2. Returns
Type Description
void

This example demonstrates deserializing a NotifyAction object.

var json = ".... some json obtained from toJson ....";

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

// deserialize and reconstruct the notify action instance
notifyAction.fromJson(json);

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