JsonEncode$

Has two parameters: Source, Options

Description

Formats the input into a valid Json value, output as a Top Query field. Can be called from the Text command to work on a Work Query field.

Options

The following Options are available, and may be space separated for valid combinations. The default used if blank is just the single value of "Array".

Note: Use the HttpType command with HttpType "application/json" for API calls, or to view in browser with JSON formatting.

Example

Test1 = JsonEncode$ "Encode me", ""
Test2 = JsonEncode$ ($CrLf && $Tab), ""
Test3 = JsonEncode$ ".123", ""
Test4 = JsonEncode$ ".123", "FIXNUMBERS"
Test5 = JsonEncode$ "00123", ""
Test6 = JsonEncode$ "00123", "FIXNUMBERS"

Example Outputs

Test1 = "Encode me"
Test2 = "\r\n \t"
Test3 = ".123"
Test4 = 0.123
Test5 = "00123"
Test6 = 123