3

I am unable to extract msg from the JSON response. @returnCode works fine and I am passing it to SSJS, but then I cannot get the msg value.

<script runat="server" language="javascript">
Platform.Load("Core","1");
var jsonresponse = Variable.GetValue("@response");
var json = Platform.Function.ParseJSON(jsonresponse.msg);
Write("<br>message: " + msg);
</script>

Here's my json for reference:

{"msg":"success","date":"2019-08-12","explanation":"xxxxxxx"}

Any idea what is wrong with above?

1 Answer 1

8

You don't have any variable named msg. Try this:

<script runat="server" language="javascript">
Platform.Load("Core","1");
var jsonresponse = Variable.GetValue("@response");
var json = Platform.Function.ParseJSON(jsonresponse);
Write("<br>message: " + json.msg);
</script>
0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.