Print Page as PDF
Decode/Encode JSON ICR (6682)

Decode/Encode JSON    ICR (6682)

Name Value
NUMBER 6682
IA # 6682
DATE CREATED 2016/12/13
CUSTODIAL PACKAGE KERNEL
USAGE Supported
TYPE Routine
DBIC APPROVAL STATUS APPROVED
ROUTINE XLFJSON
NAME Decode/Encode JSON
GENERAL DESCRIPTION
This is a utility for decoding and encoding JSON.
STATUS Active
KEYWORDS
  • JSON
  • Encode
  • Escape
  • Unescape
DURATION Till Otherwise Agreed
ID XLFJSON
COMPONENT/ENTRY POINT
COMPONENT/ENTRY POINT COMPONENT DESCRIPTION VARIABLES
ENCODE(XUROOT,XUJSON,XUERR)
This API is used for converting a local or global
array (M structure) into a JSON object.

Examples:

D ENCODE^XLFJSON("^GLO(99,2)","^TMP($J)")

D ENCODE^XLFJSON("LOCALVAR","MYJSON","LOCALERR")
VARIABLES TYPE VARIABLES DESCRIPTION
XUROOT Input
Closed array reference for M representation of
object.
XUJSON Both
Destination variable for the string array formatted
as JSON.
XUERR Both
Contains error messages, defaults to
^TMP("XLFJERR",$J).
DECODE(XUJSON,XUROOT,XUERR)
This API is used for converting a JSON object into a
local or global array (M structure).

Examples:

D DECODE^XLFJSON("MYJSON","LOCALVAR","LOCALERR")

D DECODE^XLFJSON("^MYJSON(1)","^GLO(99)","^TMP($J)")
VARIABLES TYPE VARIABLES DESCRIPTION
XUJSON Input
String/array containing serialized JSON object.
XUROOT Both
Closed array reference for M representation of
object.
XUERR Both
Contains error messages, defaults to
^TMP("XLFJERR",$J).
$$ESC(STRING)
This API is used for converting a text string to a
JSON escaped string.

Example:

W $$ESC^XLFJSON("\one\two\three\") \\one\\two\\three\\
VARIABLES TYPE VARIABLES DESCRIPTION
STRING Input
String to be escaped to JSON.
$$UES(STRING)
This API is used for converting a JSON escaped string
to a unescaped string.

Example:

W $$UES^XLFJSON("\\one\\two\\three\\") \one\two\three\
VARIABLES TYPE VARIABLES DESCRIPTION
STRING Input
JSON string to be unescaped.
DATE ACTIVATED 2017/07/06