Skip to Content
0
Former Member
Aug 04, 2015 at 12:06 PM

Problem with instantiating JSON object in script

499 Views

Hi All,

I am having difficulty in DS 1.5 (P0 and P1) using JSON as a datatype for a variable in script.

The Application Designer Guide lists JSON in the Expression type system section, and also provides a reference to it in the example under the JSON listing in the API Reference. The example provided in the document is as follows:

var result = "";

var sample = {"key1": 100, "key2": 200};

  1. sample.forEach(function(value, key) {

result = result + "Key: " + key + " Value: " + value;

});

Whenever I try to use it in script I get a red cross which tells me "You cannot instantiate a JSON object". This prevents me from operating on the object in subsequent code.

Can anyone help me with where I am going wrong?

Thanks, Pat