Make JSON Object Function
$MakeJSONObject function generates one or more JSON-style objects as a pair: name:value. The function quotes a name and value if necessary and separates pairs by comma.

The function has following parameters:

  • ID item ID, unique positive integer value for references.
  • Object Name string, name or object as a constant or as a pattern
  • Is pattern 1 or true if the engine have to use object name as a pattern. Default (empty string) or any another value means name is constant.
  • Value definition is an integer reference item(s) ID (as array in '[]' like [2] or [2,3]). or pattern between '(' and ')'.
  • Repeater, N for 0 to N items, =N for exact N values or N:M for N to M values.
  • Quote optional value. Default is 1 means add '{' before and '}' after generated object definition.


  1. $MakeJSONObject(1,Name,,($Lib(FirstNames))) generates a pair of name: {"Name":"Mike"}.
  2. $MakeJSONObject(2,Code,,($Lib(Countries,Code2))) generates a pair of country code: {"Code":"UK"}.