logo

NJP

GlideRecord: Convert to JSON (Imperative)

Developing Creative Business Solutions On ServiceNow on CodeCreative | A ServiceNow Blog · Aug 10, 2021 · article

Purpose: How to convert a GlideRecord set to a Javascript Object or JSON Object Use: Use this script in a Server Script. Typically this will be used in Scripted REST Endpoint, Service Portal Widget’s Server Script, or GlideAjax Script Include. Depending on the specific place used, conversion from a Javascript Object to a JSON string may be automatic. This technique can output either an array or an object / map depending on the intended goal.

View original source

https://codecreative.io/notebook/gliderecord-patterns-to-json/