I am trying to achieve the following. I have JSON with array:

apicall = { "CallID":"123", "Response":[ { "Header1":value1, "Header2":value2, "Header3":value3 } ]}

And I would like to parse the Response into a separate array:

var Response = [ { "Header1":value1, "Header2":value2, "Header3":value3 } ]

I try the following but keep getting error:

var Response = Platform.Function.ParseJSON(apicall.Response);

Any idea please?

  • So is your apiCall variable of a type string or an object? If it is already a type of object you don't need to ParseJSON it then. If it is a string then you need to var myVar Platform.Function.ParseJSON(apicall) then you can access myVar.Response Oct 24, 2019 at 13:22
  • How to know if it’s a string or object? Oct 24, 2019 at 13:28
  • You could do console.log(typeof(apiCall)) which should print out the type of data stored in the variable Oct 24, 2019 at 13:32

1 Answer 1


Expanding upon my comment above

//if Object
var apicall = { "CallID":"123", "Response":[ { "Header1":value1, "Header2":value2, "Header3":value3 } ]}

//Then you could just do this
var Response = apicall.Response;

//if String
var apicall = '{ "CallID":"123", "Response":[ { "Header1":value1, "Header2":value2, "Header3":value3 } ]}'

//then you would have to do this
var myObj = Platform.Function.ParseJSON(apicall);

var Response = myObj.Response;

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