1

I'm drawing a total blank. I have the following code to retrieve data from a data extension:

<script type="text/javascript" runat="server">
   Platform.Load("Core", "1.1.1");
   var api = new Script.Util.WSProxy();
   var deCustomerKey = "DE NAME HERE";
  
   var data = api.retrieve(
     "DataExtensionObject[" + deCustomerKey + "]", 
     ["AutoName", "ErrorRecipient", "MID"]
    );
  
   Write(Stringify(data));
</script>

The output I receive on the browser is obviously the API response. This is going to be a completely dumb question and I've tried Googling it, but how do I take this response data and "parse" it out? I've tried Platform.Function.ParseJSON(data) and that doesn't work (500 Error).

1 Answer 1

4

You need to use dot notation and index numbers to interact with arrays and objects to get specific information from it.

For instance:

data.Results[i] 
//where i is an iterative for the index of each object/array inside of the Results array
//for example
data.Results[0]

and for an object:

data.Results[0].Properties[0].Name  
//This then pulls the first result and first of objects in the properites array to grab the name of the property

Using these in combination will get you what you need from the array and object.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .