JSON - parse(String str)

Creates an object or primitive type from a JSON formatted string.

The JavaScript ES5 native JSON object is used instead of the JSON static methods. If your script needs the old behavior, use the encode() and decode() methods.

Table 1. Parameters
Name Type Description
str String A JSON formatted string.
Table 2. Returns
Type Description
Object An object created from the specified string.
var str = ‘{“name":"George","lastname":"Washington”}’;
var obj = JSON.parse(str);
gs.info(‘The first name is ’  + obj.name);

Output: The first name is George