JSONEncode
Description: | Converts any given VTScada value into a JSON string using UTF-8 encoding. |
Returns: | Text or Stream |
Usage: ![]() |
Script only. |
Function Groups: | String and Buffer |
Related to: | JSONParse | Pack |
Format: ![]() |
JSONEncode(InputValue[, PrettyPrint, Alphabetical, Indent, StreamVar]) |
Parameters: |
InputValue |
Required. Any value to be encoded as JSON. Text is expected to use UTF-8 encoding. |
PrettyPrint |
Optional Boolean. If TRUE, the output will have white space and line breaks added for presentation. Defaults to FALSE. |
Alphabetical |
Optional Boolean. If TRUE, dictionaries will be listed alphabetically. If FALSE, dictionaries will be listed chronologically. Defaults to FALSE. |
Indent |
Optional numeric. Ignored if PrettyPrint is FALSE. Sets the number of spaces to indent the encoding when PrettyPrint is TRUE. |
StreamVar |
Optional. If a valid stream is provided, the JSON encoded string will be appended to that stream and returned. The default is for JSONEncode to return a text string. |
Comments: |
VTScada value types that do not have a string or numeric representation, and are not dictionaries, arrays or structures, will be represented as JSON null. Arrays of up to three dimensions are supported. |