Skip to main content
Version: 5.x

JSON operator

The JSON operator is property that creates JSON from specified properties or, in common case, from form.

Syntax

JSON FROM [columnId1 =] propertyExpr1, ..., [columnIdN = ] propertyExprN [WHERE whereExpr] [ORDER orderExpr1 [DESC], ..., orderExprL [DESC]]
JSON ( formName [OBJECTS objName1 = expr1, ..., objNameK = exprK] )

Description

The JSON operator is property that creates JSON from the specified properties or form.

When exporting a form in an OBJECTS block, it is possible to add extra filters to check for the equality of the objects on the form with the values passed. These objects will not participate in building the object group hierarchy.

Parameters

  • formName

    The name of the form from which you want to export data. Composite ID.

  • objName1 ... objNameK

    Names of form objects for which filtered (fixed) values are specified. Simple IDs.

  • expr1 ... exprK

    Expressions whose values determine the filtered (fixed) values for form objects.

  • propertyExpr1, ..., propertyExprN

    List of expressions from whose values the data is exported

  • columnId1, ..., columnIdN

    A list of column IDs in the resulting JSON into which data from the corresponding property will be exported. Each list element is either a simple ID or a string literal. If no ID is specified, it is considered equal to expr<Column number> by default.

  • whereExpr

    An expression whose value is a condition for the export. If not specified, it is considered equal to the disjunction of all exported properties (that is, at least one of the properties must be non-NULL).

  • orderExpr1, ..., orderExprL

    List of expressions by which the exported data is sorted. Only properties present in the list propertyExpr1, ..., propertyExprN can be used

  • DESC

    Keyword. Specifies reverse sort order. By default, ascending sort is used.

Examples

FORM testF 
OBJECTS j = INTEGER
PROPERTIES ab='34'
OBJECTS i = INTEGER
PROPERTIES name = 'Name ' + (i AS INTEGER)
;

run() {
MESSAGE JSON (testF OBJECTS j=4 FILTERS mod(i,2) = 0);
}
MESSAGE JSON (FROM code = '1', message = 'OK');