The native JSON object is not available in SFMC SSJS — JSON.parse and JSON.stringify both throw. Use the SFMC-proprietary Platform.Function.ParseJSON and Platform.Function.Stringify (or the Stringify global) instead.

Status legend

Icon Meaning
✅ Works Available and behaves as expected
⚠️ Partial Available but with a documented caveat or bug
❌ Missing Not available — use the workaround

Members

Member ES Status Notes
JSON.parse(text) ES5 ❌ Missing Use Platform.Function.ParseJSON
JSON.stringify(value) ES5 ❌ Missing Use Platform.Function.Stringify or the Stringify global

parse

(ES5) — ❌ Missing. JSON.parse is not available. Use Platform.Function.ParseJSON(string), which parses a JSON string into an SSJS object. Coerce the input to a string first (str + "") to avoid CLR/JS boundary issues.

// ❌ Not available in SFMC:
// var obj = JSON.parse(jsonString);

// ✅ Use Platform.Function.ParseJSON:
var jsonString = '{"name":"Jane","age":30}';
var obj = Platform.Function.ParseJSON(jsonString + "");
Write(obj.name);   // "Jane"

See Platform.Function.ParseJSON for full details.


stringify

(ES5) — ❌ Missing. JSON.stringify is not available. Use Platform.Function.Stringify(value) (no Platform.Load needed) or the Stringify global (requires Platform.Load("Core", "1")).

// ❌ Not available in SFMC:
// var text = JSON.stringify(obj);

// ✅ Use Platform.Function.Stringify:
var obj = { name: "Jane", age: 30 };
var text = Platform.Function.Stringify(obj);
Write(text);   // '{"name":"Jane","age":30}'

// ✅ Or the Stringify global (after Platform.Load):
var text2 = Stringify(obj);

See Platform.Function.Stringify and Stringify for full details.

See Also