JSON Formatter
The JSON formatter plugin is optionally invoked in a SELECT statement, and arranges the selected values into a JSON document.
The selected column headings are used as keys, and the selected values are used as values.
Parameters
fields: A string with a comma-separated list of fields to be included.
Syntax
formatter JSON (
fields <string, comma-separated, representing fields to be included>
)
Example
Selecting 2 columns and formatting them as a json string:
select symbol, bid
from my_bench_stream
output stdout
formatter json(
fields 'symbol,bid'
);
Selecting you can change the key names by selecting with field aliases:
select symbol as field1, bid as field2
from my_bench_stream
output stdout
formatter json(
fields 'field1,field2'
);