Skip to main content

1E 8.1 (on-premises)

Utilities.JsonFromTable

Module

Utilities

Method

TableFromJson

Library

Core

Action

Serializes a table variable into a JSON string

Parameters

Table (table): The table variable to serialise.

Return values

Json (string): The Json serialisation that represents the table variable supplied.

Example

Serialise a table variable as Json ...

@scalar = SELECT 'abc' AS col1;
@scalarJson = Utilities.JsonFromTable(Table:@scalar);
//@scalarJson = '[{"col1":"abc"}]'

@tableJson = SELECT 'abc' AS col1 , 'def' AS col2
             UNION
                 SELECT 'ghi' AS col3, 'jkl' AS col4;
@json = Utilities.JsonFromTable(Table:@tableJson);
//@tableJson = '[{"col1":"abc","col2":"def"},{"col1":"ghi","col2":"jkl"}]'

Platforms

  • Windows

  • Linux

  • MacOS

Notes