I am trying to get a json object from my email template using SSJS. Here is my code:

 <script runat=server>

   var responseContent = HTTP.Get('https://api.myjson.com/bins/o9qvd');

   var resp = Platform.Function.parseJSON(responseContent);
   var name = resp.name;

here is the url I am calling: https://api.myjson.com/bins/o9qvd

and here is the error I am receiving:

Unable to retrieve security descriptor for this frame. Line: 5 Char: 3 var resp = Platform.Function.parseJSON(responseContent)

then I plan to get the name value using Ampscript inside my html as below:



This worked for me. Have to use [0] for the response.

var content = Platform.Function.ParseJSON(result.Response[0]);

It's Platform.Function.ParseJSON(), with a capital "P" in Parse.

Also, you only need to parse the Content property of the response object.

<script runat=server>
var response = HTTP.Get('https://api.myjson.com/bins/o9qvd');
var content = Platform.Function.ParseJSON(response.Content);
Write("<br>Name:" + content.name);

Using a cloudpage and Write() to see the output is often the best way to debug this type of issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.